For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2005 > EastAsianWidth test.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author EastAsianWidth test.
Rajarshi Das

2005-03-29, 3:57 am

Hi,
I am running a EastAsianWidth property test on z/OS using perl-5.8.6.

$str = chr(0xA1).chr(0xA2);

if ($str =~ /(\p{EastAsianWidth: A}+)/)
{
print "match";
}
else
{
print "no match";
}

First, is the above regex supposed to mean this : does $str contain chars
one or more of which has a "EastAsianWidth: Ambiguous" property ?

Also, if the regex is changed to /(\p{EastAsianWidth: a}+)/, I dont get a
match either. Is a lowercase 'a' in the regex synonymous with uppercase 'A'
?

The EastAsianWidth.txt mentions that 0xA1 has a property 'A'. So, the above
should match.

Any thoughts are welcome.

Thanks in advance,
Rajarshi.

________________________________________
_________________________
News, views and gossip. http://www.msn.co.in/Cinema/ Get it all at MSN
Cinema!

Offer Kaye

2005-03-29, 3:57 am

On Tue, 29 Mar 2005 11:08:05 +0530, Rajarshi Das wrote:
> Hi,
> I am running a EastAsianWidth property test on z/OS using perl-5.8.6.
>
> $str = chr(0xA1).chr(0xA2);
>
> if ($str =~ /(\p{EastAsianWidth: A}+)/)
> {
> print "match";
> }
> else
> {
> print "no match";
> }
>


I'm using perl-5.8.6 on Linux and your code prints "match" when I run
it, so it seems to work for me. Check your LANG and LC_* env
variables, are you working in a utf-8 environment? If not, try setting
that, or using "use utf8;" at the beginning of your script.

Hope this helps,
--
Offer Kaye
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com