in reply to RE: Using code posted on PerlMonks
in thread Using code posted on PerlMonks
Just a quick (untested) stab:
This is pretty generic and I would only use it in this context because there is an assumption that the data will be more or less valid. I think it would catch most cases. Also, I dropped a set of parentheses. I have no frickin' idea why I had them in the first place.s/<a href="[^"]+">([^<]+)<\/a>/[$1]/g;
Cheers,
Ovid
Update: I've now tested this regex modification and it appears to work fine. I also realized a potential bug in the code that would be rare, but difficult to circumvent: if someone names a sub "amp" (or another HTML character code name) and tries to call the sub with '&', this code will cheefully convert that to '&' and the resulting code will not function properly.
Update #2: buzzcutbuddha pointed out that the "Bug" I mentioned wasn't behaving quite the way I posted. It will only occur if someone names a subroutine "amp" and then posts the code without code tags. Highly unlikely, but a possibility.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: RE: Using code posted on PerlMonks
by buzzcutbuddha (Chaplain) on Jul 11, 2000 at 16:28 UTC |