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

[perl #123946] assert in /\p^ /

Thread Next
Hugo van der Sanden via RT
February 27, 2015 13:48
[perl #123946] assert in /\p^ /
Message ID:
On Thu Feb 26 17:52:20 2015, hv wrote:
> My guess is we want to support /\p^L/ but not /\p^ L/; the diff below
> is a start towards that, but it's not sufficient - I think we need to
> move the parsing out of the !SIZE_ONLY guard, or we can't be sure to
> continue at the right point.

I'm not at all sure about that, and the docs are coy - the only mention I can find of using a caret to invert a property is in perlunicode:
       You can also use negation in both "\p{}" and "\P{}" by introducing a
       caret (^) between the first brace and the property name: "\p{^Tamil}"
       is equal to "\P{Tamil}".

A CPAN grep shows braceless \p^x being tested by ShiftJIS::Regexp, and documented in passing by its pod examples, but didn't show any other uses.

Permitting it, but not skipping whitespace after the caret, results in behaviour I don't understand - I think it's successfully matching some kind of null property, so that /\p^ / ends up roughly equivalent to /./s. So maybe it is better to skip whitespace after all; on that assumption I've pushed the branch hv/braceless-property for review, with one commit for the utf8_heavy warnings and a second for the parse issues.


via perlbug:  queue: perl5 status: new

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