Regular expressions .net

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2010-03-24T16:07:42Z Indexed on 2010/03/24 16:13 UTC
Read the original article Hit count: 435

Filed under:
|
|
|

I have the following function that I am using to remove the characters \04 and nulls from my xmlString but I can't find what do I need to change to avoid removing the \ from my ending tags. This is what I get when I run this function

<ARR>20080625<ARR><DEP>20110606<DEP><PCIID>626783<PCIID><NOPAX>1<NOPAX><TG><TG><HASPREV>FALSE<HASPREV><HASSUCC>FALSE<HASSUCC>

Can anybody help me find out what do I need to change in my expression to keep the ending tag as </tag>

Private Function CleanInput(ByVal inputXML As String) As String
    ' Note - This will perform better if you compile the Regex and use a reference to it.
    ' That assumes it will still be memory-resident the next time it is invoked.
    ' Replace invalid characters with empty strings.
    Return Regex.Replace(inputXML, "[^><\w\.@-]", "")
End Function

© Stack Overflow or respective owner

Related posts about regex

Related posts about .NET