regex help


  • I've got a here-string with lots of emails in it that I want to pull out...
    how can I get all of them? \s(.+@.+)\s
    guessing that should be good enough but I cant recall how to do the
    multiline and multiple match bit...
    was going to just chop it up and do it the old fashioned way, but I figured
    I'd use this as a chance to drill in more regex :)
    rob? :)

    Justin Rich
    PowerShell V3 Guide (Technet)
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    יום שישי 02 מרץ 2012 22:31


  • One way:

    $HereString | select-string -pattern '\b(\w+@\w+?\.\w+?)\b' -AllMatches


    Another way:


    ([regex]::Matches($HereString,'\b(\w+@\w+?\.\w+)\b') | select -expand value) 

    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    • נערך על-ידי mjolinor יום שישי 02 מרץ 2012 23:16
    • סומן כתשובה על-ידי Yan Li_Moderator יום שני 05 מרץ 2012 06:21
    יום שישי 02 מרץ 2012 23:01

כל התגובות