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

Re: Regex warning

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
September 27, 2011 08:43
Subject:
Re: Regex warning
Message ID:
26443.1317138127@chthon
Karl Williamson <public@khwilliamson.com> 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.

--tom

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About