develooper Front page | perl.perl5.porters | Postings from October 2015

Re: [perl #116639] regex optimiser wrongly rejects certain matchesinvolving embedded comments

Thread Previous | Thread Next
From:
Abigail
Date:
October 19, 2015 15:07
Subject:
Re: [perl #116639] regex optimiser wrongly rejects certain matchesinvolving embedded comments
Message ID:
20151019150714.GB8552@almanda.fritz.box
On Mon, Oct 19, 2015 at 08:33:51AM -0600, Karl Williamson wrote:
> On 10/19/2015 08:26 AM, Abigail wrote:
>>      $ perl -wE '"aaaaaaaaaa" =~ /a { 1,10}/x; say $& // "UNDEF"'
>>      UNDEF
>>      $
>>
>> (In this case, it tries to match the literal string "a{1,10}" -- one
>> can wonder whether that's the most useful thing it could do).
>
> Note that this now give a warning, even without the '-w' command line  
> option:
>
> 	$ blead -E '"aaaaaaaaaa" =~ /a { 1,10}/x; say $& // "UNDEF"'
> 	Unescaped left brace in regex is deprecated, passed through in 	regex;  
> marked by <-- HERE in m/a { <-- HERE  1,10}/ at -e line 1.
> 	UNDEF
> 	$



Yes, I know.

Is that useful? I'd wager that of all the people who write

    /a { 1,10}/x

more than 99.9% of want it to behave like

    /a {1,10}/x

and none of them actually want to match the literal string

   "a{1,10}"


Abigail (who has put a space after the , in /x{n,m}/ way too often).

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