J
Jason C
Can someone look at this and tell me what I'm messing up? I've been coding all night, and my eyes have gone fuzzy
while ($text =~ #<a[^>]* href=(["'])*[^\1>]*\1[^>]*?>(.*?)</a>#gsi) {
if ($2 =~ /^http/i) {
$text =~ s#<a[^>]*? href=(["'])*([^\1>]*)\1[^>]*?>(.*?)</a>#$2#gsi;
}
}
The error is on the while() line (at least, I remove it and no more error). The error just says:
syntax error at blah.cgi line 239, near "if"
syntax error at blah.cgi line 246, near "}"
The purpose of the function is to remove the <a href=...></a> code in submitted text, but only if the linked text begins with http.
TIA,
Jason
while ($text =~ #<a[^>]* href=(["'])*[^\1>]*\1[^>]*?>(.*?)</a>#gsi) {
if ($2 =~ /^http/i) {
$text =~ s#<a[^>]*? href=(["'])*([^\1>]*)\1[^>]*?>(.*?)</a>#$2#gsi;
}
}
The error is on the while() line (at least, I remove it and no more error). The error just says:
syntax error at blah.cgi line 239, near "if"
syntax error at blah.cgi line 246, near "}"
The purpose of the function is to remove the <a href=...></a> code in submitted text, but only if the linked text begins with http.
TIA,
Jason