Need Help w/Regular Expressions please

General discussions about Advanced Find and Replace
Post Reply
deepmoz
Posts: 2
Joined: Fri Oct 27, 2006 3:48 pm

Need Help w/Regular Expressions please

Post by deepmoz »

First off, this product is amazing and it's already saving me so much time w/my project. Great Job!!

Next, I need help w/the Regular Expressions part. Rest assured that I already tried to read all the documentation about RegEx and all the posts related to it. I had to register as a last option becuase it isn't working for me.

Here goes:

I have 150 documents I have to go through and look for this line:

1)
<include:allpages id="allpages" title="Each Page has it's own title here with spaces" runat="server"></include:allpages>

and replace it with the following:

2)
<include:master controlname="allpages" variables="title=titlegoeshere|which=screen" runat="server"></include:master>

My question is this, how do I look for the line marked as "1" above where everything in the title is different and replace it w/the lines marked as number "2?"

Please let me know, thanks!!

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

Post by Abacre »

In regular expressions any even empty symbol is .*

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:
<include:allpages id="allpages" title=".*" runat="server"></include:allpages>

Replace with:
<include:master controlname="allpages" variables="title=titlegoeshere|which=screen" runat="server"></include:master>

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

deepmoz
Posts: 2
Joined: Fri Oct 27, 2006 3:48 pm

Post by deepmoz »

Tried that and it wasn't working. I checked 'S', but should I have 'M', 'I', and 'G' checked as well?

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

Post by Abacre »

Please send a sample file to support@abacre.com
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

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

Post by Abacre »

In fact in your file you have two spaced before runat="server"
So the correct pair should be:
Search for:
<include:allpages id="allpages" title=".*".*runat="server"></include:allpages>

Replace with:
<include:master controlname="allpages" variables="title=titlegoeshere|which=screen" runat="server"></include:master>

You can make it even more flexible, for example:
Search for:
<include:allpages.*title=".*".*></include:allpages>

Replace with:
<include:master controlname="allpages" variables="title=titlegoeshere|which=screen" runat="server"></include:master>

In this case it will find all include:allpages tags having title
parameter and replace it with needed text.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply