A few things...
If ($var1 =~ /\b$var2?\b/I) {
^^ it should be "if" not "If"
If ($var1 =~ /\b$var2?\b/I) {
^ The switch is "i" not "I"
Print "cannot contain that word.\n";
^^^^^ the "p" in print is lower case (are you using Win32::ASP?)
if ($var1 =~ /\b$var2?\b/i) {
^ What is this for? Is the last char optional?
If $var1='foo' and $var2='foof', this would be a true statement. Is that
what you wanted?
Rob
-----Original Message-----
From: Batchelor, Scott [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 20, 2002 5:40 PM
To: '[EMAIL PROTECTED]'
Subject: Pattern Matching...again...
I am trying to match a word in a string. I am using to variables here is my
small piece of code that should be doing this.
If ($var1 =~ /\b$var2?\b/I) {
Print "cannot contain that word.\n";
}
Only for some reason it isn't working.
Any help is greatly appreciated.
Scott
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]