Welcome › Forums › General PowerShell Q&A › Regex to find any text separated by an @
This topic contains 3 replies, has 2 voices, and was last updated by
I'm fighting to make a regex to find any text after a space and before an @ and any text before that until it reaches a whitespace again...
$myString = @"
dys dkan jdna firstname.lastname@example.org hhaksda d asda email@example.com
dsad ada sdd asd firstname.lastname@example.org fdfsd
(Select-String -InputObject $myString -Pattern '\w+@\w+\.\w+.\w+' -AllMatches).Matches | ft * -AutoSize
I only get the email@example.com without the manolo...
I want to find any text that has a @ in the middle... (Ex.: firstname.lastname@example.org, email@example.com, etc)
You could use a pattern like that
and it fits with the examples you posted but a little more sofisticated would be this I think
You're the man! Thanks a lot!
De nada. 😉
The topic ‘Regex to find any text separated by an @’ is closed to new replies.