* Thomas Kinghorn <thomask@???> [20031029 14:16]: wrote:
> Hi List.
>
> I am still trying to come to grips with regex's.
>
> I am using the one below to reject variations on "SEX"
>
> \b[Ss][ ./_*-]*[Ee][ ./_*-]*[Xx]\b
>
> Is this syntax correct.
> I have tested using various mails and so far no false positives.
> Have tried S e X, SeX, S-E-X, which matched AND Sussex,essex & asexual,
> which did not match.
>
> Just need some "expert" advise.
Okay. I am not an expert by any definition, but I see that you need to
escape the slashes. So you end up with
\b[Ss][ .\/_*-]*[Ee][ .\/_*-]*[Xx]\b
.. which I tested and _did_not_ match
PCRETEST is your friend. I am just learning one or two things about
pcre at the moment, so don't crucify me for anything;)
112$ pcretest
PCRE version 3.9 02-Jan-2002
re> /\b[Ss][ .\/_*-]*[Ee][ .\/_*-]*[Xx]\b/
data> S E X
0: S E X
data> SEXX
No match
data> Sussex
No match
data> Essex
No match
data> assexual
No match
cheers
- wash
+----------------------------------+-----------------------------------------+
Odhiambo Washington . WANANCHI ONLINE LTD (Nairobi, KE) |
<wash at wananchi dot com> . 1ere Etage, Loita Hse, Loita St., |
GSM: (+254) 722 743 223 . # 10286, 00100 NAIROBI |
GSM: (+254) 733 744 121 . (+254) 020 313 985 - 9 |
+---------------------------------+------------------------------------------+
"Oh My God! They killed init! You Bastards!"
--from a /. post