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
Jonathan Sailor
November 4, 2018 03:59
Re: [perl #133630] unexpected 'variable length lookbehind' error in/h(?<!ssh)base/i
Message ID:
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.


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