On Tue, 7 Aug 2001, Ashutosh Salgarkar wrote:
Hi all,
We are trying to search japanese keyword using a search string(in perl using
pattern matching).
We are facing problem while searching a particular keyword as given below,
$searchStr =~ m/$key1/i
when $key1 contains ����
We get an error as follows
/����/: unmatched [] in regexp
Please suggest the solution to overcome the problem.
my $safe_key = quotemeta($key1);
$searchStr =~ m/$safe_key/;
is probably what you want. I am presuming you are trying to use m// to
search for exact string matches rather than exploiting the full regex
facilities.
--
Benjamin Franz
Programs must be written for people to read, and only
incidentally for machines to execute.
---Abelson and Sussman