You're right.  Mistook it for (.\s) for some reason.  My description of .*
still stands however.  

But the following should be:
(p(ost)?[.\s]*o(ffice)?[.\s]*box)

post(anynumberofperiodsorspacecharacterclassitems)office(anynumberofperiodso
rspacecharacterclassitems)box

p(anynumberofperiodsorspacecharacterclassitems)o(anynumberofperiodsorspacech
aracterclassitems)box

p(anynumberofperiodsorspacecharacterclassitems)office(anynumberofperiodsorsp
acecharacterclassitems)box

post(anynumberofperiodsorspacecharacterclassitems)o(anynumberofperiodsorspac
echaracterclassitems)box

Steve


-----Original Message-----
From: Keith Ivey [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 08, 2008 10:27 AM
To: Fun with Perl
Subject: Re: regex of the month (decade?)


Stoll, Steven R. wrote:
> (p(ost)?[.\s]*o(ffice)?[.\s]*box)
> po(b|x|drawer|stoffice|[ ]bx|box)
> p[\/]o
> b(x|ox|uzon)
> a(partado|ptdo)
> 
> Which matches:
> (p(ost)?.*o(ffice)?.*box)
> 
>
post(anynumberofanythingexceptnewline)office(anynumberofanythingexceptnewlin
> e)box

'[.\s]*' matches any number of periods or whitespace characters, since 
'.' is not special inside a character class.  It's not the same as '.*'. 
  Also, even if '.' were special, '\s' matches newline along with other 
whitespace characters.

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Washington, DC

Reply via email to