|Do you know where your variables are?|
How do I write a regex for 'does not contain' a string.by IraTarball (Monk)
|on Aug 09, 2002 at 13:52 UTC||Need Help??|
IraTarball has asked for the wisdom of the Perl Monks concerning the following question:
I've been regretably away from my mistress, Perl, for a while, and now I thougt I would whip out a short script to do some global text edits on a bunch of html files.
I was able to come up with something but it raised a question. Can you write a regex that matches all strings not containing the substring string 'foo'?
Here are my particular details...
I have a bunch of html files with blank images as spacers, but these don't always render right in mozilla unless they have a 'style="display:block"' attribute. Some designers were good about adding these and some were not, leading to fles whith a mix of haves and have not image tags. So what I thought was, "Find all the image tags that don't have a 'style="display:block"' attribute and add it. But how would you right that? I came up with:
this works, but it seems that I should be able to do this in a single s/// instead 2 matches and a swap. Thanks for taking the time to look at my post. I did a search for docs before posting but I could certainly have missed something. Pointers to pertinent nodes are appreciated.