I am wondering if this is possible with Regex. I want to extract tokens from a line like:
Select a [COLOR] and a [SIZE].
Ok, simple enough - I can use (\[[AZ]+\])
However, I also want to extract text between tokens. Basically, I want the relevant groups to be higher:
"Select a " "[COLOR]" " and a " "[SIZE]" "."
What is the best approach for this? If there is a way to do this with RegEx, that would be great. Otherwise, I assume that I need to extract the tokens and then manually execute the MatchCollection loop and parse the substrings based on the indices and lengths of each match. Note that I need to keep the order of lines and tokens. Is there a better algorithm for this kind of string parsing?
Mike christensen
source share