Regular Expression Need Help On

General discussions about Advanced Find and Replace
Post Reply
Posts: 1
Joined: Thu Nov 30, 2006 7:55 pm

Regular Expression Need Help On

Post by mickster » Thu Nov 30, 2006 8:01 pm

Hi i need to remove the -3**** number after my words but before the .html

<a href="North-East-30404.html">North East</a>
<a href="North-West-30426.html">North West</a>
<a href="South-East-30448.html">South East</a>

so I end up with the following

<a href="North-East.html">North East</a>
<a href="North-West.html">North West</a>
<a href="South-East.html">South East</a>

I have to many to do by hand. What regular expression could i use to do this? any suggestions?


Site Admin
Posts: 1220
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre » Thu Nov 30, 2006 11:07 pm

For your particular task you may use the following:

Go to main menu - Action - Options - Batch Replace
check "Modifier S"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
<a href="(\w+)-(\w+)-3\d+\.html">\1 \2</a>

Replace with:
<a href="$1-$2.html">$1 $2</a>

That's all I verified it works perfectly.
Kind regards,
Abacre Limited

Post Reply