This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Need help with regex

Hello,

which regular expression should I use, when I want to filter mails that contain the strings "lottery", "claims officer" and "winning", no matter in which order?
I did read some regex tutorials, but I still can't find a way to do it. Something like

Code:
 (?i)(lottery|claims officer|winning){3}



would also match "lottery lottery lottery". Could somebody show me the solution?

Regards, thtran


This thread was automatically locked due to age.
Parents
  • I did something like that once for an MP3 search in Perl...

    The "elegant" way to do it was this line of Perl:

    if (m/(?=.*(lottery))(?=.*(claims officer))(?=.*(winning))/i)  

    HOWEVER, it was VERY slow, so I ended up doing this:

    if (/$one/i and /$two/i and /$three/i)

    but this is 3 regexes, not one, so you'd probably have to go with the first option.
    Like I said though, it is VERY slow, at least with Perl... be careful!

    Barry
Reply
  • I did something like that once for an MP3 search in Perl...

    The "elegant" way to do it was this line of Perl:

    if (m/(?=.*(lottery))(?=.*(claims officer))(?=.*(winning))/i)  

    HOWEVER, it was VERY slow, so I ended up doing this:

    if (/$one/i and /$two/i and /$three/i)

    but this is 3 regexes, not one, so you'd probably have to go with the first option.
    Like I said though, it is VERY slow, at least with Perl... be careful!

    Barry
Children
No Data