S
sb
Hello I'm new to regular expressions so this is probably an easy
question.
I have one large string that consists of multiple "lines" that are "\r\n"
delimited. How can I use regex to parse each line of the string and create
two groups: 1 that contains all lines that start with "X_" and 1 that
contains all lines that start with "Y_"?
I think I've got the regex pattern right but I can't seem to figure out how
to access the index/length properties of each line that was found in group.
The regex pattern I'm using is below:
Match m = Regex.Match(mystring, "^(?<plines>[X][_])|(?<clines>[Y][_]))",
RegexOptions.Multiline | RegexOptions.ExplicitCapture);
....
The bottom line is that I need to know the index/length of each "line" that
starts with "P_" or "C_". I know I can do this without using regex but I'm
simplifying things quite a bit here.
I hope that make sense.
TIA!
sb
question.
I have one large string that consists of multiple "lines" that are "\r\n"
delimited. How can I use regex to parse each line of the string and create
two groups: 1 that contains all lines that start with "X_" and 1 that
contains all lines that start with "Y_"?
I think I've got the regex pattern right but I can't seem to figure out how
to access the index/length properties of each line that was found in group.
The regex pattern I'm using is below:
Match m = Regex.Match(mystring, "^(?<plines>[X][_])|(?<clines>[Y][_]))",
RegexOptions.Multiline | RegexOptions.ExplicitCapture);
....
The bottom line is that I need to know the index/length of each "line" that
starts with "P_" or "C_". I know I can do this without using regex but I'm
simplifying things quite a bit here.
I hope that make sense.
TIA!
sb