in reply to Re: Re: Re: Re: Perlre interpretation required
in thread Perlre interpretation required
$var =~ /(["'])[^(??{"$1"})]*?\1/; which worked unless $1 contained a +special character (forgot the character, but it wasn't a quote),I don't quite understand this? How could $1 contain anything other than ["']?
I guess $1 had to be a quote, but in the error message, $1 was replaced with the string of matched characters, which were all non-quotes since I negated $1 in the regex. I don't recall the entire [^(??{"$1"})] being replaced, which makes it seem like the string of non-quotes in the error message was made of characters from only $1.
Anyway, it appears as though the characters matching ^$1 in my regex were interpolated, causing errors, and quoting them in the regex would have quoted the square brackets, the ^, the (??{", etc. and prevented the very character that I really wanted to quote from being matched.
My simple .*? between the quotes works for me, and my other idea is overkill for my current project anyway. I'll analyze the solutions from this thread when I have a chance. I'm sure they solve the problem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Re: Perlre interpretation required
by BrowserUk (Patriarch) on May 04, 2003 at 09:46 UTC |