use utf8; my $test1 = "AAgUhYJAAAgAhsqdtbb/K0f7PU\+D"; print "string match\n" if ( $test1 =~ m/\Q$test1\E/ ) ;
You don't need to escape the / inyour string, simply anchor it in the regexp with \Q \E. See perldoc perlre for details. Kind regards, Mark Anderson SMS Deployment The Royal Bank of Scotland 113 Dundas Street, Edinburgh, EH3 5DE http://www.manufacturing.rbs.co.uk/GTrswi/ > -----Original Message----- > From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED] > Sent: Monday, September 13, 2004 10:03 AM > To: [EMAIL PROTECTED] > Subject: String matching ? > > *** WARNING : This message originates from the Internet *** > > > > Hello guys, > > my $test1 = "AAgUhYJAAAgAhsqdtbb\/K0f7PU\+D"; > if ( $test1 =~ m/$test1/ ) > { > print "string match \n "; > } > > The above code behaves strange ( in my opinion ) and I do not know why > and how can it be fixed ? > In my opinion it should print "string match " but it does not. If I cut > off the last character D then it prints "string match". > > As far as I know if I want to match any metacharacter in a string all > that I have to do is to append a "\" in front of it as I did. So, what is > wrong with the code above ??!! > > Thanks in advance! > Regards, > Nicu > << File: ATT5745741.txt >> The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB The Royal Bank of Scotland plc is authorised and regulated by the Financial Services Authority and represents The Royal Bank of Scotland Marketing Group. The Bank sells life policies, collective investment schemes and pension products and advises only on the Marketing Group's range of these products and on a With-Profit Bond produced by Norwich Union Life (RBS) Limited. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs