in reply to Regular Expression problem when Extracting Start\ VALUE \End

Backslashes are a pain in the back. Slash. The problem is that your regex ends up being /TRicky\(.*?)\endTricky/ because your variables interpolate. When that gets compiled as a regex, it's a problem because the trailing backslash of "TRicky\" has escaped the opening parenthesis. I would suggest using my $StartTag = qr/TRicky\\/; my $EndTag = qr/\\endTricky/; The qr// operator will keep things properly backslashed later, because the content is treated like a regex.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re: Regular Expression problem when Extracting Start\ VALUE \End
by gasho (Beadle) on Sep 30, 2005 at 15:50 UTC
    Thank you all for quick responses
    #Works fine my $StartTag = qr/TRicky\\/; my $EndTag = qr/\\endTricky/;