Global S/R HTML Tag Management

General questions about using WildEdit

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
yowbooks
Posts: 3
Joined: Fri Dec 03, 2004 8:41 pm

Global S/R HTML Tag Management

Post by yowbooks »

I'm doing eBooks and I need to use WildEdit to clean my HTML files to semantically pure text. I need to remove attributes to HTML tags.

REMOVE HTML TAG ATTRIBUTES and ARGUMENTS
I need to globally search all occurrences of the <P> tag with or without various attributes such as:

<P STYLE="text-align:center" align="center">
<p align="center">

which I need to change to a semantically clean tag:
<p>

REMOVE TAGS
In other cases, I need to globally remove a specific tag altogether. For example:

<a href="http://dx.doi.org/10.1572/1597720046">Palm eBook</a>

I need to remove the open and close tags, but leave the literal text as shown below.

Palm eBook

If you will help me with this, you will make my life immeasurably easier.

Regards, Marshall Masters
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

for the p stuff:

search for
<p[^>]*>
replace by
<p>

might be problematic if you have > characters within attribute values - regex is good for many things, but not for everything.

for the remove tag: same method as above, but as you do not clearly specify what to remove, no code from me
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

To change
<a href="http://dx.doi.org/10.1572/1597720046">Palm eBook</a>
into
Palm eBook

search for
<a href=[^>]+>(.+?)</a>
replace by
$1
I'm using POSIX extended Regular expression and Replacement format.
Then I open up and see
the person fumbling here is me
a different way to be
yowbooks
Posts: 3
Joined: Fri Dec 03, 2004 8:41 pm

Many thanks MudGaurd

Post by yowbooks »

I couldn't get your search string to work, but since I'm still at the bumbling fool stage and took a wild guess. I changed it to:

<p[^>]*.>

Worked like a champ.

Many many many thanks, Marshall
yowbooks
Posts: 3
Joined: Fri Dec 03, 2004 8:41 pm

Thank you s_reynisson

Post by yowbooks »

The strip routine for the anchor worked beautifully. When this stuff works, it is flat out amazing.

Many thanks, Marshall
Post Reply