Hi List,
I am trying to use regular expressions on unicode strings, trying to
match for right-to-left characters using \p{BidiR} but I can't seem to
get it to work... Here's my test script:
use Encode;
use Test::More 'no_plan';
use strict;
use warnings;
use utf8;
# This string is "What is unicode?" in arabic.
# Hence it's got plenty of right to left characters.
my $text = "ما هي الشفرة الموحدة يونِكود ؟";
# make sure that the utfness of the string is known by perl
ok (Encode::is_utf8 ($text), 'utf8 flag is on');
# perldoc unicode says:
# For example, "\p{BidiR}" matches characters that are normally written right
to left.
like ($text, qr/\p{BidiR}/, 'text has some right to left characters');
# just to make sure... if the thing worked it should die 'FOO'
die 'FOO' if ($text =~ /\p{BidiR}/);
Any ideas?
Cheers,
--
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver(_at_)mkdoc(_dot_)com - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/