Pasting Filename into text

General discussions about Advanced Find and Replace
Post Reply
C16
Posts: 1
Joined: Fri Jul 14, 2006 2:59 pm
Location: UK, Yorkshire

Pasting Filename into text

Post by C16 »

Hi,

I'm using registered version of 2.3, which I bought today :D

I have about 1500 html files that I need to replace a string of text in the original with the actual file name. For example:

File name is Cannon.html, this is a example of just one file. All the rest are the same but with different file names.

And the html code within that document goes as follows:

<!applet code="Minus4j.class" codebase="./" width=60% height=60% archive="Minus4j.jar">
<!applet code="Minus4j.class" codebase="./" width=60% height=60% archive="Minus4j.jar">
<applet code="Minus4j.class" codebase="./" width=60% height=60% archive="Minus4j.jar">
<param name="rom" value="plus4.rom">
<param name="prg" value="A_07.prg">
<param name="fps" value="50">
<param name="round" value="255">
</applet>
</p>

I want to do a batch find and replace it to look like the following:

<!applet code="Minus4j.class" codebase="./" width=60% height=60% archive="Minus4j.jar">
<!applet code="Minus4j.class" codebase="./" width=60% height=60% archive="Minus4j.jar">
<applet code="Minus4j.class" codebase="./" width=60% height=60% archive="Minus4j.jar">
<param name="rom" value="plus4.rom">
<param name="prg" value="Cannon.html">
<param name="fps" value="50">
<param name="round" value="255">
</applet>
</p>

I've tried following a few solutions on your forum, but they dont seem to work for me :( Is there any chance you can help me out on this?

Thank you so much for this brilliant product.


Regards,


Chris

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

Post by Abacre »

Hi Chris,

Yes. It's possible to do with Advanced Find and Replace.

Go to main menu - Action - Options - Batch Replace
check "Modifier S"
check "Modifier M"
uncheck "Modifier G"
check option "Replace in File Bodies"
check option "Include File Name into Search Scope"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
.*\\(\w+\.html)\r\n(.+<param name="prg" value=").*">

Replace with:
\r\n$2$1">

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

ajivani
Posts: 10
Joined: Mon Apr 18, 2005 8:11 pm

Replacing characters in XML File

Post by ajivani »

I have XML files in which I want to replace everything that is between the following tags with the specific text between these tags.

<AISParams></AISParams>

For example In a file I have

<AISParams>Clues.NewMgr|Yes|Clues.UseCluesBBEDb|Yes|Clues.InputFile|733AE3A.IUR|Clues.ServerName|CLMGRAI01|Clues.VersionType|PROD||BBE.OutputStyle|BBE</AISParams>

I want to replace everything that is between these two tags

<AISParams></AISParams>

with the same text between the two tags.

<AISParams>Clues.NewMgr|Yes|Clues.UseCluesBBEDb|Yes|Clues.InputFile|P1899086413.wur|Clues.ServerName|CW2PTPOFVYDH|Clues.VersionType|Beta|Mustang.EffDate|2010/12/31|Clues.Flags|- -cluedate request|Calc.DumpXML|ByName|Clues.SaveFiles|Yes|BBE.OutputStyle|BBE</AISParams>

Post Reply