Regex to find any text separated by an @


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 hhaksda d asda
dsad ada sdd asd fdfsd 

Using this:

(Select-String -InputObject $myString -Pattern '\w+@\w+\.\w+.\w+' -AllMatches).Matches | ft * -AutoSize

I only get the without the manolo…
I want to find any text that has a @ in the middle… (Ex.:,, 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

Olaf Soyk,

You’re the man! Thanks a lot!

De nada. :wink: