Help with sophisticated replace

General discussions about Advanced Find and Replace
Post Reply
olevy
Posts: 2
Joined: Sat Apr 22, 2006 1:45 pm

Help with sophisticated replace

Post by olevy »

Hi,

I need to replace the following 2 lines:

document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n');
document.write(' CODEBASE="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,2,0" ID=flash_ad WIDTH=160 HEIGHT=260>\n');

with this line:
DrawFunction(160,260);

The only problem is that I need to extract the width and height from the first phrase and insert them into the DrawFunction.

Thanks in advance to anyone who can help

Regards,
Oren

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

Post by Abacre »

Yes, it's possible with AFR. We will provide you with sample
expression which has been tested. It will work for your case.
Later you may customize it. Use it as a hint.
The trick is to escape reserved chars: . \ ( )
by \

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:
document\.write\('<OBJECT CLASSID.*\);.*document\.write\(' CODEBASE=.*WIDTH=(\d+) HEIGHT=(\d+)>\\n'\);

Replace with:
DrawFunction($1,$2);

That's all I verified it works perfectly.
Last edited by Abacre on Sat Apr 22, 2006 9:57 pm, edited 1 time in total.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

olevy
Posts: 2
Joined: Sat Apr 22, 2006 1:45 pm

Works perfect. The software was worth every penny I spent

Post by olevy »

Thank you very much Roman for your help

Post Reply