Page 1 of 1

find a tag except for certain attribute

Posted: Thu Jun 20, 2002 1:24 pm
by pat
Hi, I hope someone knows the answer..
I'm trying to find some html-tags which lack certain attributes. I want to find all <img tags which don't contain the attribute 'alt' and end with />.

I've tried the following:
<img\( [^/alt]*\)>

but that doesn't work..

So, tags like this must be excluded:
<img src=xxx alt=y border=0 width=10 height=10 /glt;

Thanks,
Pat.

Re: find a tag except for certain attribute

Posted: Thu Jun 20, 2002 4:51 pm
by Ed
1. Find a character that's unused in text eg ~
2. Replace all < with ~\n<
3. Search for
^\(<[^i]\|<.[^m]\|<..[^g]\|$\|[^<]\|<img.*alt\)
and Mark All
4. Menu item Search/"Invert all Bookmarks"
5. Do with them what you want
6. Replace all ~\n with nothing

Not sure what you mean ending in \>
This will find
<img src=xxx border=0 width=10 height=10 />;
<img src=xxx border=0 width=10 height=10 >;
<img src=xxx border=0 width=10 height=10 ;
But not
<img src=xxx alt=y border=0 width=10 height=10 />;
<img src=xxx alt=y border=0 width=10 height=10 >;
<img src=xxx alt=y border=0 width=10 height=10 ;
<ipg src=xxx alt=y border=0 width=10 height=10 /glt;
<imq src=xxx alt=y border=0 width=10 height=10 /glt;
<jmg src=xxx alt=y border=0 width=10 height=10 /glt;
<mgi src=xxx alt=y border=0 width=10 height=10 /glt;
<ipg src=xxx border=0 width=10 height=10 /glt;
<imq src=xxx border=0 width=10 height=10 /glt;
<jmg src=xxx border=0 width=10 height=10 /glt;
<mgi src=xxx border=0 width=10 height=10 /glt;


Is this what you want?

Re: find a tag except for certain attribute

Posted: Tue Jul 09, 2002 1:08 pm
by Pat
I want to find tags like this:
<img src=xxx border=0 width=10 height=10 />
<img src=xxx border=0 width=10 height=10 >

So, tags like these must be excluded:
<img src=xxx alt=y border=0 width=10 height=10 />
<img src=xxx alt=y border=0 width=10 height=10 >

The ending in /> is because I want to find xHTML tags.

Thanks.

Re: find a tag except for certain attribute

Posted: Mon Jul 22, 2002 8:11 am
by Marek Mänd
>Author: Pat (---.gx.nl)
>Date: 07-09-02 14:08
>So, tags like these must be excluded:
><img src=xxx alt=y border=0 width=10 height=10 />
><img src=xxx alt=y border=0 width=10 height=10 >
>The ending in /> is because I want to find xHTML tags.

btw xHTML tag attributes must be also properly quoted...
FWIW