Page 1 of 1

Remove path from <img src=...>

Posted: Fri Mar 31, 2006 1:45 pm
by Mr.Chaos
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!

Posted: Fri Mar 31, 2006 2:17 pm
by Abacre
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.

Posted: Fri Mar 31, 2006 2:50 pm
by Mr.Chaos
That's great! Thank you!