develooper Front page | perl.perl5.porters | Postings from December 2010

Re: RFC: regex modifier to restrict ascii character /i matching to ascii

Thread Previous | Thread Next
From:
Eric Brine
Date:
December 22, 2010 17:54
Subject:
Re: RFC: regex modifier to restrict ascii character /i matching to ascii
Message ID:
AANLkTikafLx4=FYLZrN2y7FkvfMMtyKVa9bEPoHYU6Tm@mail.gmail.com
On Wed, Dec 22, 2010 at 7:38 PM, Abigail <abigail@abigail.be> wrote:

> On Wed, Dec 22, 2010 at 04:23:26PM -0700, karl williamson wrote:
> > No one objected when I said I would implement the /a regex modifier
> > without it affecting caseless matching, so that's what I'm doing.  I
> > also said that I would implement an extension which is to prevent an
> > ASCII character from matching any non-ASCII character.  Thus for example
> > "\N{KELVIN SIGN}" would not match /[kK]/ under this scenario.
>
> I'm a bit confused about the last couple of sentences. It seems to imply
> that *without* /a, "\N{KELVIN SIGN}" would match /[kK]/, which it doesn't
> in 5.12.x. Are you saying that C<< "\N{KELVIN SIGN}" =~ /[kK]/ >> is true
> in 5.14?
>

I think he meant /[kK]/i.

v5.13.8-30-g98df743
$ perl -E'use charnames ":full"; say "\N{KELVIN SIGN}" =~ /[kK]/i ||0'
1

v5.12.2:
$ perl -E'use charnames ":full"; say "\N{U+20}\N{KELVIN SIGN}" =~
/\N{U+20}[kK]/i ||0'
1

(The \N in the pattern is just there to force Unicode semantics.)

- Eric


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