develooper Front page | perl.perl5.porters | Postings from November 2018

Re: [perl #133630] unexpected 'variable length lookbehind' error in/h(?<!ssh)base/i

Thread Previous | Thread Next
From:
Jonathan Sailor
Date:
November 4, 2018 03:59
Subject:
Re: [perl #133630] unexpected 'variable length lookbehind' error in/h(?<!ssh)base/i
Message ID:
alpine.DEB.2.11.1810302210210.17665@techhouse.brown.edu
On Tue, 30 Oct 2018, Tony Cook via RT wrote:
>> perl -le 'print if /h(?<!ssh)base/i'
>>
>> produces the error
>>
>> Variable length lookbehind not implemented in regex m/h(?<!ssh)base/
>> at -e line 1.

> I believe it's the "ss", which can match ß (\xdf, LATIN SMALL LETTER
> SHARP S), which makes it variable length.

Yup, that's it all right.  It's even listed as an example in perldiag,
right under my nose :/

Though, I'm a little surprised that

     LANG=C LC_ALL=C perl -e 'qr/(?<!ss)/di'

hits this. My expectation would be that, since /d means "to use the
'Default' native rules of the platform except when there is cause to use
Unicode rules instead, as follows: [various conditions that wouldn't
apply unless/until the rx is matched against a utf8 string]" and /i. I
guess the engine has to compile it to match both "ss" and \N{LATIN
SMALL LETTER SHARP S}, and then for non-utf8 strings, the second branch
just never gets hit or something.

Feel free to close as RTFM I guess.

~jon.

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