To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 4442
4441  |  4443
Subject: 
Re: Regular Expression help?
Newsgroups: 
lugnet.off-topic.geek
Date: 
Tue, 8 Jul 2003 19:00:12 GMT
Viewed: 
361 times
  
On Tue, Jul 08, 2003 at 06:44:29PM +0000, David Eaton wrote:
For *BORDER* tags, you're in luck:

/<img(\s+[^bB]\w+=("[^"]"|\S*))*>/i
                          ^
missing "*" here --------/

But that is on the (valid?) presumption that the ONLY attribute for an
<img> tag that starts with the letter "B" is "BORDER". I suppose I
could be wrong what with all the custom attributes that MSIE has, etc.
But if there ARE other attributes that start with B, then the above
DOESN'T work, since it'll ignore anything that's got an attribute that
starts with B.

wouldn't this also break on this:

<img src="1.jpg" alt="Some Text with Contrived B=something in it">

:)

But other than that, good idea to look at what's valid :)

--
Dan Boger
dan@peeron.com



Message has 1 Reply:
  Re: Regular Expression help?
 
(...) Woops, yep (...) ? Wouldn't it not, since it matches on the double quote first? IE it would match alt="........." as a single dealy? I'll test.... Ran as a test: foreach( '<img src="foo.jpg">',# matches '<img border="" src="foo.jpg">',# no (...) (21 years ago, 8-Jul-03, to lugnet.off-topic.geek)

Message is in Reply To:
  Re: Regular Expression help?
 
(...) For *BORDER* tags, you're in luck: /<img(\s+[^bB]\w+=("...|\S*))*>/i But that is on the (valid?) presumption that the ONLY attribute for an <img> tag that starts with the letter "B" is "BORDER". I suppose I could be wrong what with all the (...) (21 years ago, 8-Jul-03, to lugnet.off-topic.geek)

11 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR