Re: regex of the month (decade?)

[email protected] (David Landgren) Tue, 08 Jan 2008 23:08:50 +0100
Newsgroups perl.fwp
Message-ID <[email protected]>
Stoll, Steven R. wrote:
> After solving the case sensitivity issue, separating the alternations, and
> solving the un-escaped /, here is what we are left with.
> 
> (p(ost)?[.\s]*o(ffice)?[.\s]*box)
> po(b|x|drawer|stoffice|[ ]bx|box)
> p[\/]o
> b(x|ox|uzon)
> a(partado|ptdo)

If we unroll that to

post[.\s]*o(ffice)?[.\s]*box
p[.\s]*o(ffice)?[.\s]*box
pob
pox
podrawer
postoffice
po[ ]bx
pobox
p[\/]o
bx
box
buzon
apartado
aptdo

reassembling it, we obtain

(?:p(?:o(?:st(?:[.\s]*o(ffice)?[.\s]*box|office)|(?: 
b)?x|b(?:ox)?|drawer)|[.\s]*o(ffice)?[.\s]*box|\/o)|ap(?:arta|t)do|b(?:uzon|o?x))

I'm happy that they thought to check for 'pox' as a shorthand to 
postoffice box. I'll remember to use that next time I need to address 
such a letter.

David