Replace() and carriage returns

Hi, I've got some text which contains this at various places:

Obviously there is a carriage return in the above text, so why can't I do this:
XML1 = XML1.Replace( "<dummy>remove</dummy>\r\n</state>", " />")

It doesn't work. I also tried just with "\r" or "\n", with NewLine() and with Chr(10)+Chr(13) and vice-versa.

None of it works. How can I do this?

Hi ClausS,

What you have in that XML is identation which actually makes it easier to read. XML parsers usually cope really well with this and ignore it. What is your issue with the formating on the XML?

If you really want to to remove that formating you should try to use regular expressions. Text extension has the actions for the replace operation and I'm sure you'll find plenty of these questions out there like this one.

I hope this helps you out.
I know about XML indentation but I need to get rid of this tag.
Why don't the above Replace() sentences work as expected?
I am well aware of regular expressions and in fact \r and \n are part of that syntax and ought to work as well.
"." in regular expressions doesn't match \n, so I'm stuck with something like [\r\n]* which doesn't work either.
Is this an error in the string library in Outsystems?
If all you want is to remove the tag why not use Replace(Var,"<dummy>remove</dummy>","")?
I have to replace this:
<state id="Name">

with this:
<state id="Name" />

And in any case replacements with \r and \n ought to work, right?
Replace with NewLine() should work (see attach) the problem is if you have any white space (spaces, tabs) in the middle. That's why using an XML parser to remove the node or a regular expression parser would be more effective.