Page 1 of 1

Copy and replace

Posted: Sat Oct 06, 2007 9:49 am
by Gerna1964

I have over a hundred HTML files with a unique JPG picture name in it. Want I want is to copy the JPG file name and replace with a new code .


File name HTML file: N_art_13.html (or N_art_256.html)

<IMG SRC="b_13.jpg" ALT="Artikel 111" BORDER="0">

Replace into:
<a rel="lightbox" href="b_13.jpg">
<img src="b_13.jpg" width="300" height="261" class="style11"></a>

Number in filename (13) is the same as in d the code.

I hope that you can help me.

Thanks in advance,

Re: Copy and replace

Posted: Tue Oct 09, 2007 8:50 pm
by Abacre
Go to main menu - Action - Options - Batch Replace
check "Include File Name into Search Scope"
check "Modifier S"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
N_art_(\d+).html\r\n(.*)<IMG SRC="b_\1.jpg" ALT=".*" BORDER="0">

Replace with:
\r\n$2<a rel="lightbox" href="b_$1.jpg">\r\n<img src="b_$1.jpg" width="300" height="261" class="style11"></a>

That's all I verified it works perfectly.

Re: Copy and replace

Posted: Wed Oct 10, 2007 12:54 pm
by Gerna1964

Thank you very much.

Time to purchase the software :D

Geert Gernaat

Re: Copy and replace

Posted: Thu Oct 11, 2007 9:46 am
by Gerna1964
Hi Roman,

There is something strange with AFR or on my computer.

If I past your code into AFR and execute the program with regular expressions AFR can't find any HTML document.

But if a open the file(s) in a HTML editor or notepad and save the document without any changes, at that moment AFR find the string and replace it with the correct code???

Do you have any idea hiw this is possible.


Re: Copy and replace

Posted: Thu Oct 11, 2007 11:49 am
by Abacre
It's not clear what do you mean. Could you please explain it again?

Other programs may exclusively use your file without giving right to AFR (or other programs) to use it. So you should normally close other programs using the file before using AFR on the files.