On Mon, 7 Jul 2003, Wenjie Wang wrote: > Greetings, > > I'm using regular expressions to parse strings read in from a data file. > The data file happened to have text which contains "++" and it was treated > as "Nested quantifiers before << HERE in regex m/%s/" at run time. Is there > any way to avoid it? It can be simply repro in following code snip: > ------------------------------8<--------------------------- > my $myLine = 'Micrisoft Visual C++'; > print "Got you.\n" if 'ABC' =~ /$myLine/i; > ------------------------------>8---------------------------
Use the \Q escape to escape regex meta characters in your data: print "Got you.\n" if 'ABC' =~ /\Q$myLine\E/i; **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs