I'm sure this is possible, but my brain hurts trying ...

General discussions about Advanced Find and Replace
Post Reply
Ulysses
Posts: 2
Joined: Mon Jul 24, 2006 1:22 am

I'm sure this is possible, but my brain hurts trying ...

Post by Ulysses » Mon Jul 24, 2006 1:44 am

Hi,

I just can't figure out the search/replace coding to change lines of text from:

<a name="john">JOHN</a>
<a name="doris">DORIS</a>
<a name="abdul">ABDUL</a>

to

<a name="john">&nbsp;</a>JOHN
<a name="doris">&nbsp;</a>DORIS
<a name="abdul">&nbsp;</a>ABDUL

... where the names are many and all different.

Thanks very much.

Abacre
Site Admin
Posts: 1201
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Post by Abacre » Mon Jul 24, 2006 8:47 am

Hi,

It's quite simple :)

We can provide at least two possible solutions.
Go to main menu - Action - Options - Batch Replace
uncheck "Modifier S"
uncheck "Modifier G"
check "Modifier M"
check "Modifier I"
check "Modifier E"

Go to Batch replace tab, check on "Use regular expressions".

Put search for and replace with pairs in the batch grid.

Solution #1:
It will search all <a> tags where precisely john=JOHN, doris=DORIS etc
i.e. "name" parameter matches to the text inside <a> tag.
Use the following pair:

Search for:
<a name="(.*)">\1</a>
Replace with:
<a name="$1">&nbsp;</a><%=Upper("$1")=%>


Solution #2:
This is less precise solution. It will simply take all found <a> tags
having name parameter and then replace the text in <a> by &nbsp; and
put this text out of the tag (after </a>). Drawback: it can match for
the following string, for example: <a name="john">DORIS</a>. Result
will be: <a name="john">&nbsp;</a>DORIS

Use the following pair:
Search for:
<a name="(.*)">(.*)</a>
Replace with:
<a name="$1">&nbsp;</a>$2

That's all I verified it works perfectly.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Ulysses
Posts: 2
Joined: Mon Jul 24, 2006 1:22 am

Post by Ulysses » Mon Jul 24, 2006 12:01 pm

You beauty!! Thank you very much indeed for your wisdom.

Brilliant, and dare I say, extremely valuable "quality-time" saving stuff.

Thanks again Roman. :D :D :D :D

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests