develooper Front page | perl.perl5.porters | Postings from March 2000

[ID 20000321.012] regex with \p

Thread Next
From:
Richard Foley
Date:
March 21, 2000 06:25
Subject:
[ID 20000321.012] regex with \p
Message ID:
38D7873D.62877924@m.dasa.de
I know there is some mention of something along these lines in 'perldoc
perlre' and 'man utf8', but I've either misunderstood it (:-) or the
docs could say more, or the error message could say more, or ...:

This code:
# --------------------------------------
	my $str = 'abc-\pxyz';
	if ('xyz' =~ /$str/) {
	        print "found '$str'\n";
	} 

Produces this lovely message:
# --------------------------------------
Uncaught exception from user code:
        Can't find unicode character property definition via main->x or
x.pl at unicode/Is/x.pl line 0
        Carp::croak('Can\'t find unicode character property definition
via main->x or...') called at /usr/local/lib/perl5/5.6.0/utf8_heavy.pl
line 8
        utf8::croak('Can\'t find unicode character property definition
via main->x or...') called at /usr/local/lib/perl5/5.6.0/utf8_heavy.pl
line 30
        utf8::SWASHNEW('utf8', 'x', '', 0, 0, 0) called at
/usr/local/lib/perl5/5.6.0/utf8_heavy.pl line 78
        utf8::SWASHNEW('utf8', '', '# comment^J+utf8::x^J', 1, 0) called
at unicode/Is/x.pl line 0  

If on the other hand we use 'abc-\xyz' (\x instead of \p) we get some
hint as to what may be going on:
# -------------------------------------- 
Illegal hexadecimal digit 'y' ignored at ./trial line 6 (#1)
 
    (W digit) You may have tried to use a character other than 0 - 9 or
A - F, a - f
    in a hexadecimal number.  Interpretation of the hexadecimal number
stopped
    before the illegal character.
 
Segmentation fault  

BTW: No amount of saying 'use utf8' or 'no utf8' makes any difference
either.

Ciao
Richard Foley
---
richard@rfi.net
'Ciao' - shorter than 'Aufwiedersehen'

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