Hi Mike,
The way that the regular expression I posted works is that look-arounds are
non-capturing patterns. They indicate that the pattern indicated must match,
but it is not part of the match. So, to translate my regular expression:
(?<=XX XX XX XX XX).*(?=YY YY YY YY YY)
A match is zero or more of any character. It must be preceded by "XX XX XX
XX XX XX" and it must be followed by "YY YY YY YY YY YY". So that, for
example, in the string:
XX XX XX XX XX123 ABCYY YY YY YY YY
The match will be "123 ABC"
In the string:
XX XX XX XX XX.....YY YY YY YY YY
The match will be "..."
In the string
XX XX XX XX XX123 ABC
There is no match (no "YY..." sequence following)
I'm not sure what the question "How do I use this in a statement" means. But
here is the authoritative Regex reference:
http://msdn2.microsoft.com/en-us/lib...ons.regex.aspx
--
HTH,
Kevin Spencer
Microsoft MVP
Chicken Salad Shooter
http://unclechutney.blogspot.com
A man, a plan, a canal, a palindrome that has.. oh, never mind.
"AMP" <am******@gmail.comwrote in message
news:11*********************@m7g2000cwm.googlegrou ps.com...
>I am new at regex, How do I use this in a statement. I want to operate
on the string between the 2 Markers.
Thnaks
Mike
Kevin Spencer wrote:
>(?<=XX XX XX XX XX).*(?=YY YY YY YY YY)
Uses a positive Look-behind, and a positive Look-ahead.
--
HTH,
Kevin Spencer
Microsoft MVP
Chicken Salad Shooter
http://unclechutney.blogspot.com
A man, a plan, a canal, a palindrome that has.. oh, never mind.
"AMP" <am******@gmail.comwrote in message
news:11*********************@c28g2000cwb.googlegr oups.com...
Hello,
I have a long string that I need to take a section out of and use.
The section I need always starts with "XX XX XX XX XX"
and always ends with "YY YY YY YY YY"
I want to throw away the rest and use whats between the 2 Marker
strings.
I am not sure how to do this with Regex.
Any help would be appreciated
Thanks,
Mike