首页 > Xml节点内容正则表达式替换

Xml节点内容正则表达式替换

<SmsReceiveEntity>
        <Aid>170157188</Aid>
        <Code>Y</Code>
        <Interface>MAS_C</Interface>
        <IsEncrypted i:nil="true" />
        <Message>Y9</Message>
        <MobilePhone>13777817790</MobilePhone>
        <MsgType i:nil="true" />
        <OrderID i:nil="true" />
        <ProcessStatus i:nil="true" />
        <ReceiveTime>2014-04-11T09:30:39.76</ReceiveTime>
        <SmsId>4257452</SmsId>
        <TotalCount>79</TotalCount>
    </SmsReceiveEntity>
    <SmsReceiveEntity>
        <Aid>33598323</Aid>
        <Code>Y</Code>
        <Interface>MAS_C</Interface>
        <IsEncrypted i:nil="true" />
        <Message>y70</Message>
        <MobilePhone>13501876289</MobilePhone>
        <MsgType i:nil="true" />
        <OrderID i:nil="true" />
        <ProcessStatus i:nil="true" />
        <ReceiveTime>2014-04-11T09:32:25.327</ReceiveTime>
        <SmsId>4257478</SmsId>
        <TotalCount>79</TotalCount>
    </SmsReceiveEntity>
    <SmsReceiveEntity>
        <Aid>33804163</Aid>
        <Code>N</Code>
        <Interface>MAS_C</Interface>
        <IsEncrypted i:nil="true" />
        <Message>N?S?NSHQeOO?N?QmN$fZ?NS?e?N ?b?0?R^??LN:g ????
</Message>
        <MobilePhone>15829789671</MobilePhone>
        <MsgType i:nil="true" />
        <OrderID i:nil="true" />
        <ProcessStatus i:nil="true" />
        <ReceiveTime>2014-04-11T09:33:35.247</ReceiveTime>
        <SmsId>4257513</SmsId>
        <TotalCount>79</TotalCount>
    </SmsReceiveEntity>

有这样的xml字符串,现在需要通过正则表达式匹配节点里面的内容,然后把内容进行编码,内容中间可能会有回车,急求正则表达式。目前的表达式:string regText = @"(.*?)";只能在同一行才能匹配到。


这个解答应该可以帮到你

【热门文章】
【热门文章】