Re: regex of the month (decade?)

"Thomas L. Shinnick" <[email protected]> Mon, 07 Jan 2008 16:51:56 -0600
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
At 04:06 PM 1/7/2008, Uri Guttman wrote:

>^([Pp]([Oo][Ss][Tt])?[.\s]*[Oo]([Ff][Ff][Ii][Cc][Ee])?[.\s]*[Bb][Oo]
>[Xx])|[Pp][Oo]([Bb]|[Xx]|[Dd][Rr][Aa][Ww][Ee][Rr]|[Ss][Tt][Oo][Ff][Ff]
>[Ii][Cc][Ee]|[ ][Bb][Xx]|[Bb][Oo][Xx])|[Pp][/][Oo]|[Bb]([Xx]|[Oo][Xx]|
>[Uu][Zz][Oo][Nn])|[Aa]([Pp][Aa][Rr][Tt][Aa][Dd][Oo]|[Pp][Tt][Dd][Oo])
>
>
>the challenge: itemize the stupidities. the case issue is only 1! i
>don't want to even post the 'spec' unless asked for it. i saw this on
>usenet today.

Why use  [ ]  in one place when  \s  is known and used previously?

And  ^  (i.e. \A)  doesn't distribute across the alternatives, so 
only the first alternative must match at beginning of string.

Assuming use of   (?ix)  then is this the de-obfuscated equivalent?
   ^( P ( OST)? [.\s]* O (FFICE)? [.\s]* BOX )
   |
   PO ( B | X | DRAWER | STOFFICE | [ ]BX | BOX )
   |
   P[/]O
   |
   B ( X | OX | UZON )
   |
   A ( PARTADO | PTDO )



-- 
I'm a pessimist about probabilities; I'm an optimist about possibilities.
     Lewis Mumford  (1895-1990)