Page 1 of 1

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

Posted: Mon Jul 24, 2006 1:44 am
by Ulysses
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.

Posted: Mon Jul 24, 2006 8:47 am
by Abacre
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.

Posted: Mon Jul 24, 2006 12:01 pm
by Ulysses
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