SPUG: regex problems...
seanow0 at email.msn.com
Fri Oct 1 13:11:25 CDT 1999
I don't pretent to be an expert at Perl, so hopefully this isn't a silly question everyone but me knows:
I'm doing some search & replace functions, and I've assigned some big strings of HTML to variables, and I've got a question about the s/// function:
If I say:
$snip='<a href="http://blah.foo.com/index.htm" class="style"';
$code =~ s/$snip/[replacement/gsi;
$code =~ s/<a href="http://blah.foo.com/index.htm" class="style"/[replacement/gsi;
I know example 2 is wrong and I need to escape a few characters, but why won't example 1 work? If I change $snip to ="blah" then the expression will return true, but the full html variable always returns false, even though I can see that exact line in my code. Can anyone tell me what I'm doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the spug-list