Regex to find any text separated by an @

This topic contains 3 replies, has 2 voices, and was last updated by  Olaf Soyk 1 year, 1 month ago.

  • Author
  • #67599

    Vandrey Trindade


    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)

  • #67602

    Olaf Soyk

    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



  • #67639

    Olaf Soyk

    De nada. 😉

You must be logged in to reply to this topic.