develooper Front page | perl.perl5.porters | Postings from September 2011

Re: Regex warning

Thread Previous | Thread Next
Tom Christiansen
September 27, 2011 08:43
Re: Regex warning
Message ID:
Karl Williamson <> wrote
   on Tue, 27 Sep 2011 09:06:33 MDT: 

> Good point.  I think though that we could accept quantifiers while 
> deprecating other instances.  The current \b doesn't distinguish, but is 
> immaterial.  However, I think you've found a bug for \B{3,12}.

Things like \b and \B are zero-width assertions.  It makes no sense
to quantify those.  It does make sense to quantify other things though.

I don't know how to get the different word senses though.  There are alternate
word boundaries that are desirable.  The definitions of \b and \B are completly
reliant on the definition of \w:

    a \b is the same as (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
    a \B is the same as (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))

ICU has a compilation flag that changes around boundaries.  That would 
correspond to adding something like /foo/b or (?b), except that I very
very very much never want to do that again; I want to find a better way 
to introduce such options.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About