develooper Front page | perl.perl5.porters | Postings from April 2017

Re: [perl #128420] Changes in regex recursion in 5.24

Thread Previous | Thread Next
Jan Goyvaerts
April 12, 2017 06:03
Re: [perl #128420] Changes in regex recursion in 5.24
Message ID:
Karl Williamson wrote:

 > The single letter constructs, which you assume are meant to be Posix
 > classes, don't warn, as none of them are close enough to a legal class
 > name that they could have been intended to be one.

Dinkumware's implementation of std::regex (and possibly other 
implementations) support [:w:], [:s], and [:d:] as shorthands for 
[:word:], [:space:], and [:digit:].

Boost::regex additionally supports [:v:] and [:h:] to match vertical and 
horizontal whitespace.

 > If you want to see what a pattern compiles into, and hence what it 

Thanks for the tip.

 > That shows that [[:w:]] matches a string that contains a ']'
 > immediately preceded by one of '[', ':', or 'w'.
 > It's impossible to figure out for sure what was the programmer's intent.

If the programmer intended to add a literal : to the character class 
then a single : would suffice.

Anyway, Perl 5.24's behavior is fine.  It's just that the change took me 
by surprise.  It certainly doesn't break any existing regexes when 
porting code from 5.22 to 5.24.

Kind regards,
Jan Goyvaerts


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