6
我有以下的功能,我使用刪除字符\ 04和空從我的xmlString,但我無法找到我需要做什麼改變,以避免刪除從我的結尾標籤中。這是我所得到的,當我運行這個功能正則表達式解析XML在.NET
<ARR>20080625<ARR><DEP>20110606<DEP><PCIID>626783<PCIID><NOPAX>1<NOPAX><TG><TG><HASPREV>FALSE<HASPREV><HASSUCC>FALSE<HASSUCC>
任何人可以幫助我找出我需要在我的表情變化,以保持結束標記爲</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\[email protected]]", "")
End Function
這不會刪除' '\ 0''和'' 從你的字符串\ 04''字符,而是消除一切,除了幾個字符(''<', '>,空白,'.','@'和'-')。另外,提供輸出的輸入是什麼? – Thomas 2010-03-24 16:11:47
你可以發佈一行或兩行的輸入到這個函數的樣子嗎? – 2010-03-24 16:12:16
@Thomas,'\ w'是單詞字符,而不是空格。 – Joel 2010-03-24 16:14:17