Thank you for replying. 
The only thing is that when I shouldn't be escaping the right paren
since they indicate the variable $1 to be printed below.
I tried escaping the paren but it results in a nonmatch.
Could you let me know if I am looking at it incorrectly? Thanks again.
Ahmer


-----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 $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 works fine.

Yes, single versus double quotes.. may want to look up the differences..

:D Leaving that as an exercise for the reader..

//Anders//

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to