Thank you for pointing me in the right direction. That did work.
Ahmer
-Original Message-
From: BOLCATO CHRIS (esm1cmb) [mailto:[EMAIL PROTECTED]
Sent: Monday, June 21, 2004 10:43 AM
To: Khan, Ahmer H; [EMAIL PROTECTED]
Subject: RE: Using regular expression as a variable.
Hello
Hi.
See inline comments..
[snip]
Here is my code.
1 $filename = 'This is a directory\file\sub.txt';
2 $regex = '\\(\w+\.\w+)$';
$regex = '\\(\w+\.\w+\)$';
Missed to escape the last ) ...
[snip]
However if I copy/paste the actual regexp from line 2 into line 3 and
not use the variable, the program
-Original Message-
From: Anders Holm [mailto:[EMAIL PROTECTED]
Sent: Monday, June 21, 2004 8:22 AM
To: Khan, Ahmer H
Cc: [EMAIL PROTECTED]
Subject: Re: Using regular expression as a variable.
Hi.
See inline comments..
[snip]
Here is my code.
1 $filename = 'This is a directory\file\sub.txt';
2
Hello,
Hi,
I'm having a problem where somehow a regexp does not work and the program
results in an error when the regexp is called using a variable.
Here is my code.
1 $filename = 'This is a directory\file\sub.txt';
2 $regex = '\\(\w+\.\w+)$';
3 if ($filename =~ /$regex/)
4 {print $1;} else
5