I was wondering if it was possible to append a character (to be used as a delimiter later on) to each instance of a regex match in a string.
I'm parsing text for a string between < >, and have a working regex pattern -- though this collapses each instance of the match.
What I would like to do is append each instance of a match with a , so I can call the .split(',') method later on and have a collection of string I can loop through.
$testString = "<[email protected]><[email protected]>"
$testpattern = [regex]::Match($testString, '(?<=<)(.*)(?=>)').Value
$testPattern will now be "[email protected]@gmail.com"
What I would like to is to add a delimiter between each instance of the match, to call the .split() method to work with a collection after the fact.
I know this isn't the only way to handle the problem above, and definitely not the most efficient -- but I ended up doing the following.
So to restate the question, I need to parse email headers (to line), for all the smtp addresses (value between '<' and '>'), and store all the addresses in a collection after the fact.