As you probably appreciate I was trying to abstract the problem.
I have a single string that consists of a header and a body. The
header does have the number of body records present which is
variable.
In my program I don't know whether the string passed is this
kind of format or just a "normal" one.
It seems I need to extract the repeating section and then
use contains on that.
Thanks for the quick feedback.
John.
----Original Message Follows----
In message <[EMAIL PROTECTED]>, "John Goalby" writes:
>Input string : HEADERAABBCCDD
>Output : AA, BB, CC, DD
>
>I have tried a numbe of things but cannot get it:
>
>HEADER(.{2})*
>
>This ONLY gives me DD.
>
>Any way to get the groups for AA, BB, CC and DD?
Capturing parentheses will only save the last thing they matched which
is why you only get DD. There are certain things you need to supplement
with program logic. You will have to iterate and look for each match in
turn unless you know you have a fixed number of character pairs, in which
case HEADER(..)(..)(..)(..) will do, unless what you really want is
HEADER((.)\2)((.)\4)((.)\6)((.)\8)
(The difference being that the first expression will match HEADER123456
while
the second expression won't, but will match HEADER11223344)
daniel
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp