I think this should be easy, but I'm not having much luck here. I'm
sure someone can help me out. I'm trying to extract some text from a
couple of files in a directory. I want to then take the extracted data
and put it into another file.
So, I'm trying to match: "Email: firstname.lastname@example.org
" This should
be pretty simple. Here's what I do so far:
$pattern = [regex] "Email: (?<email>[^\s]+)"
$m= Get-ChildItem | Select-String -pattern $pattern
So this would get a collection of match items. I supposed I could then
look through the match items, and rematch the pattern against each,
but that seems wasteful. How can I do this all at once? Perhaps I
don't want Select-String?