I have a string like this:
|T1| This is some text for the first tag |T2| this is some text for the second tag
I need to parse out the tags and the text that is associated with each one. The tags are not known ahead of time but they are delimited by \|\w+\|.
I know there is something I can do here as far as capturing groups and so on but after messing around in powershell the best I can come up with is to first isolate each pairing using \|\w+\|.*with the ExplicitCapture option and then parse out the tag and text from there.
But that is doing double the work and totally not super-cool haxor. What’s the regex-pro way to do this?
Edit: Actually I realize that it’s late and I misread my results. The above doesn’t actually work so now I don’t even have a bad solution.
Matches
|T1| This is some text for the first tag |T2| this is some text for the second taginto
EDIT:
Use Regex Groups to get parts of match;
Swithed to named groups instead of numbered