[San-Diego-pm] accents

Douglas Wilson dgwilson1 at cox.net
Tue Oct 26 21:32:17 CDT 2004



Joel Fentin wrote:
> I need to see if what the Spanish language operator enters is contained 
> in a long hunk of text. Something like this:
> if($X =~ /$Y/){[Do something]}
> 
> The operator might enter josé, JOSÉ, or jose. He might enter niño, NIÑO, 
> or nino.
> 
> An i modifier to m// will take care of case. Is there any fell swoop way 
> of taking care of accents?

Those characters all have the high order bit on, so here is a crude
way:
my $str = "josé, JOSÉ, or jose. He might enter niño, NIÑO";

my @funny_chars = $str =~ /([^\x00-\x7F])/g;

print "@funny_chars\n";

Cheers,
Doug



More information about the San-Diego-pm mailing list