You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-user@jakarta.apache.org by Georg Schneemayer <ge...@schneemayer.de> on 2001/10/06 00:28:25 UTC
Problem with character class/ranges: [-x] != [x-]
Hi!
I've a problem with ranges. It seems that "-" acts as a range operator in a
character class independent of its position.
[x-] matches x,y,z,...
[-x] matches ...,v,w,x
and not only "x" and "-"
I this a bug/feature?
Perl acts different in this case, from "man perlretut":
If "'-'" is the first or last character in a character class, it is treated
as an ordinary character; "[-ab]", "[ab-]" and "[a\-b]" are all equivalent.
What is the proposed behaviour of regexp?
Thanks in advance,
Georg Schneemayer
Re: Problem with character class/ranges: [-x] != [x-]
Posted by Georg Schneemayer <ge...@schneemayer.de>.
On Saturday 06 October 2001 00:28, you wrote:
> I've a problem with ranges. It seems that "-" acts as a range operator in a
> character class independent of its position.
>
> [x-] matches x,y,z,...
> [-x] matches ...,v,w,x
>
> and not only "x" and "-"
>
> I this a bug/feature?
>
> Perl acts different in this case, from "man perlretut":
>
> If "'-'" is the first or last character in a character class, it is treated
> as an ordinary character; "[-ab]", "[ab-]" and "[a\-b]" are all equivalent.
>
Oh, sorry. Now I RTFM and found this bug report which address the above:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2121
Bye, Georg Schneemayer