Text replace with regular expression failing

Hi,

I have a file that i want to change some text in.

The text in the file is:

<setting name="DotNetNukeUrl" serializeAs="String">
        <value>http://localhost/DotNetNukeGilde</value>

 And My regular expression to find this text is:

\<setting name="DotNetNukeUrl".+$\n.+\<value\>.+\<value

And the replace text is:

\<setting name="DotNetNukeUrl".+$\n.+\<value\>%DotNetNukeUrl%<value

---

 

If i run this regular expression search in a text editor (I have used TextPad), the correct result is shown, but Finalbuilder returns No Match found. But as far i as i can see a have only used expressions that the TRegExpr uses.

Is this a bug, or do I use is wrong?

 

Regards

Magne

Hi Magne,

Is the actual expression you want to match just “.+” (ie “any string”)? If so, just trim off the backslashes and it should work fine. FinalBuilder does not required any kind of \RegExp\ syntax to know it’s looking at a regular expression (as long as you enable regular expressions.) In particular, it will treat . as an escaped period (ie an exact match for “.”.)

- Angus

Hi, thanks for the response.

In my previous post the actual text was missing since the text contained angel-brakkets (or what they are called)

I have changed the post so it contains the whole text now.

But now I see it as < and > but when I try to edit it again it shows up correct with angel-brakkets.

Magne

Hi Magne,

Unfortunately, our forum software has some serious issues with escaping HTML. Sorry for the inconvenience.

Would it perhaps be possible for you to attach a text file with the exact strings, or post a screenshot of the action?

- Angus

Just doing a test here:
The text in the file is:


http://localhost/DotNetNukeGilde

Regular expression:

<setting name=“DotNetNukeUrl”><value>.+<>

Replacement text:

<setting name=“DotNetNukeUrl”><value>%DotNetNukeUrl%</value></value>

Heh, that worked. Looks like the work around is to enter the text you want, submit it, then copy the mangled text, and paste that again as the input.

Steve

Hi,

I tried to post screenshots, by adding two jpg files as message attachments but I cant see that it turns up in the forum...

In this post i have attached two screenshots, findstring tab and replacestring tab.

Regards Magne

 

findstring.JPG

replacestring.JPG

Ah now it worked...

Also adding a picture of the actual text that I am looking for:

 

What i want to do is replace the path with the path in my variable %DotNetNukeUrl%

textToFind.JPG

Hi Magne,

The quick answer to your problem is that - because the files are XML - it is probably a lot easier to use the XML actions to edit them. If you use a File Iterator action (to iterate the FileSet) with an Edit XML File Action as the child, you can set the XML action up like this:

XPath = //setting[@name=‘DotNetNukeUrl’]/value
Attribute =
Value = %DotNetNukePath%


Alternatively, if you absolutely have to use a Regular Expression for some reason, you can set it up as shown in these screenshots. Let me know if you’d like an explanation of the syntax I’ve used.

Hth. Sorry for the delay.

Regards,

Angus

findregexp.jpg

replaceregexp.jpg

Thank you for the reply.

I changed it to Edit XML and it is now working.

Magne