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.
find a tag except for certain attribute
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
Ed
Re: find a tag except for certain attribute
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?
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?
-
Pat
Re: find a tag except for certain attribute
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.
<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.
-
Marek Mänd
Re: find a tag except for certain attribute
>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
>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