Remove path from <img src=...>

General discussions about Advanced Find and Replace
Post Reply
Mr.Chaos
Posts: 2
Joined: Fri Mar 31, 2006 1:32 pm

Remove path from <img src=...>

Post by Mr.Chaos » Fri Mar 31, 2006 1:45 pm

Hi,

I have several html files, that contain images (jpg and gif). I want to strip the paths, and keep only the filename, can that be done?

They all have different codes, from which I want to remove the red parts:

<img src="http://www.somedomain.com/blabla/file1.jpg">
<img src=http://www.somewhere.net/blabla/blabla2/file2.jpg>
<img src=http://www.myhomepage.com/folder/file3.gif height=100>
<img src="http://www.hello.com/file4.jpg" alt="blabla">

tags like <a href="http://www.google.nl>Google</a> should stay intact!


Thanks for the help!

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

Post by Abacre » Fri Mar 31, 2006 2:17 pm

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

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
<img src=.*/(.+\.\w+.*)>

Replace with:
<img src=$1>

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

Mr.Chaos
Posts: 2
Joined: Fri Mar 31, 2006 1:32 pm

Post by Mr.Chaos » Fri Mar 31, 2006 2:50 pm

That's great! Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest