Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Unicode property problems in RegExp

Reply
Thread Tools

Unicode property problems in RegExp

 
 
vnick@freenet.de
Guest
Posts: n/a
 
      06-03-2005
I have a problem with a relatively simple RE with Unicode Properties:

[280] tmp% perl -Dr -e '$f = "KURZ_1"; if ($f =~ /[_\d\p{IsUpper}]+/)
{print"$&\n"};' |& less

[281] tmp%

The RegExp debugger output shows this:

Matching REx `[_\d\p{IsUpper}]+' against `KURZ_1'
Matching stclass `ANYOF[0-9_{unicode}+utf8::IsDigit +utf8::IsUpper]'
against `KURZ_1'
Guessing start of match, REx `^_<' against
`/cadappl/perl/5.8.5/lib/5.8.5/utf8.pm'...
String not equal...
Match rejected by optimizer


So I made some more trials with UP RE's and their output is even
stranger:

[289] tmp% perl -e '$f = "KURZ"; if ($f =~ /[\p{IsUpper}]+/) {print
"$&\n"};'

@8(p
[290] tmp% perl -e '$f = "KURZ"; if ($f =~ /\p{IsUpper}+/) {print
"$&\n"};'

[291] tmp% perl -e '$f = "KURZ"; if ($f =~ /\p{IsLu}+/) {print
"$&\n"};'
@4v
[292] tmp% perl -e '$f = "KURZ"; if ($f =~ /(\p{IsLu}+)/) {print
"$1\n"};'
@1îd
[293] tmp% perl -e '$f = "KURZ"; if ($f =~ /[A-Z]+/) {print "$&\n"};'
KURZ
[294] tmp%

Anybody out there who can tell me what is wrong here?
Thanks
vnick

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regexp Unicode property names strange behavior? Ammar Ali Ruby 3 10-23-2010 09:33 AM
[regexp] How to convert string "/regexp/i" to /regexp/i - ? Joao Silva Ruby 16 08-21-2009 05:52 PM
Ant setting property by regexp substitution on an existing property kevin cline Java 2 07-26-2008 02:21 PM
Ruby 1.9 - ArgumentError: incompatible encoding regexp match(US-ASCII regexp with ISO-2022-JP string) Mikel Lindsaar Ruby 0 03-31-2008 10:27 AM
Programmatically turning a Regexp into an anchored Regexp Greg Hurrell Ruby 4 02-14-2007 06:56 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57