Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: How do I write a regex for 'does not contain' a string.

by fruiture (Curate)
on Aug 09, 2002 at 14:25 UTC ( [id://188916]=note: print w/replies, xml ) Need Help??


in reply to How do I write a regex for 'does not contain' a string.

Well, I'd suggest you do not want to do what your question's title asks for (and what Abigail has already told you). You already can see it in your first attempts on solving your problem: you won't match img elements that have an attribute different from src in the beginning. You will miss elements, that have 'display:block' in their title-attribute. You will somehow produce duble style-attributes inmany cases...

The solution is to use HTML::Parser or HTML::Tokeparser to fastly run through the text and extract img elements and explicitly check the style attribute for the display-property and add it if not present. That may be a bit slower in the end, but it will get all cases and produce good results.

--
http://fruiture.de
  • Comment on Re: How do I write a regex for 'does not contain' a string.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://188916]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2025-02-09 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (95 votes). Check out past polls.