KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
A user enters a set of names with accents and tildes: Renato Núñez, David DeJesús, and Edwin Encarnación My database has anglicized names for these people @names = ('Renato Nunez','David DeJesus','Edwin Encarnacion'); I wish to do a regexp match on these names. $string = "Renato Núñez, David DeJesús, and Edwin Encarnación"; foreach my $name (@names) { print "found:$name\n" if ($name =~ /$string/); } As currently presented I get no matches. I tried this, but it didn't work. $string = "Renato Núñez, David DeJesús, and Edwin Encarnación"; foreach my $name (@names) { $name =~ s|a|[áa]|; $name =~ s|e|[ée]|; $name =~ s|i|[íi]|; $name =~ s|o|[óo]|; $name =~ s|u|[úu]|; $name =~ s|n|[ñn]|; # Originally: print "found:$name\n" if ($name =~ /$string/); # Corrected to: print "found:$name\n" if ($string =~ /$name/); } EDIT: sorry I had $name and $string reversed in the last line. Any suggestions?
Tags (comma-separated)
Save Edits
Cancel