# Text replace with regular expression failing

**URL:** https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788
**Category:** Bugs
**Created:** [February 23, 2007, 1:11am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788 "2007-02-23T01:11:33Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [February 23, 2007, 1:11am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/1 "2007-02-23T01:11:33Z")

</div>

Hi,

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

The text in the file is:

&lt;setting name="DotNetNukeUrl" serializeAs="String"&gt;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;value&gt;http://localhost/DotNetNukeGilde&lt;/value&gt;

&nbsp;And My regular expression to find this text is:

\&lt;setting name="DotNetNukeUrl".+$\n.+\&lt;value\&gt;.+\&lt;value

And the replace text is:

 

\&lt;setting name="DotNetNukeUrl".+$\n.+\&lt;value\&gt;%DotNetNukeUrl%&lt;value

 

---

 

&nbsp;

 

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?

 

&nbsp;

 

Regards

 

Magne

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [February 25, 2007, 11:12am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/2 "2007-02-25T11:12:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [February 27, 2007, 3:42am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/3 "2007-02-27T03:42:02Z")

</div>

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 &lt; and &gt; but when I try to edit it again it shows up correct with angel-brakkets.

Magne

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [February 27, 2007, 4:00am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/4 "2007-02-27T04:00:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [March 1, 2007, 7:08am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/5 "2007-03-01T07:08:41Z")

</div>

Just doing a test here:  
The text in the file is:  
  
  
[http://localhost/DotNetNukeGilde](http://localhost/DotNetNukeGilde)  
  
Regular expression:  
  
\<setting name=“DotNetNukeUrl”\>\<value\>.+\<\>  
  
Replacement text:  
  
\<setting name=“DotNetNukeUrl”\>\<value\>%DotNetNukeUrl%\</value\>\</value\>

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [March 1, 2007, 7:09am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/6 "2007-03-01T07:09:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [March 5, 2007, 10:08am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/7 "2007-03-05T10:08:51Z")

</div>

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,&nbsp;findstring tab and replacestring tab.

Regards Magne

&nbsp;

![findstring.JPG](https://www.finalbuilder.com/forums/uploads/default/original/2X/f/ff2af23f19a83f96a591098e9d448e6c9972c452.jpeg)

![replacestring.JPG](https://www.finalbuilder.com/forums/uploads/default/original/2X/8/88ceb7fb4ec306026552b3f35aea1f91b931de2f.jpeg)

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [March 5, 2007, 10:09am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/8 "2007-03-05T10:09:30Z")

</div>

Ah now it worked...

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

&nbsp;

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

![textToFind.JPG](https://www.finalbuilder.com/forums/uploads/default/original/2X/f/f81e2ada594be27400720d7ae6e9b7f0d1a32390.jpeg)

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [March 5, 2007, 11:49am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/9 "2007-03-05T11:49:46Z")

</div>

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](https://www.finalbuilder.com/forums/uploads/default/original/2X/1/10df8897883621adb6e42125e2e18d4a6da8273c.jpeg)

![replaceregexp.jpg](https://www.finalbuilder.com/forums/uploads/default/original/2X/f/fddbf50aa518fd93622f081366597da9414f8bdf.jpeg)

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [March 7, 2007, 3:15am UTC](https://www.finalbuilder.com/forums/t/text-replace-with-regular-expression-failing/2788/10 "2007-03-07T03:15:08Z")

</div>

Thank you for the reply.

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

Magne
