我試圖在下面的示例xml中找到特殊字符的外觀。如何爲此場景編寫正則表達式模式
<?xml version="1.0"?>
<PayLoad>
<requestRows>****</requestRows>
<requestRowLength>1272</requestRowLength>
<exceptionTimestamp>2012070202281068-0700</exceptionTimestamp>
<exceptionTimestamp>201$2070202281068-0700</exceptionTimestamp>
<exceptionTimestamp>20120(702022810680700</exceptionTimestamp>
<exceptionDetail>NO DATA AVAILABLE FOR TIME PERIOD SPECIFIED =</exceptionDetail>
</PayLoad>
我必須找到包含$一個完整的標籤,(,=, - 人物爲了這個,我已經寫了下面的正則表達式模式 (<[\w\d]*>\w*(?<value>[^\w]+)\w*\d*</[\w\d]*>)
並返回下面的輸出(在快報工具運行)
<requestRows>****</requestRows>
<exceptionTimestamp>2012070202281068-0700</exceptionTimestamp>
<exceptionTimestamp>20120(702022810680700</exceptionTimestamp>
,但它應該返回空兩個enrty也。
<exceptionTimestamp>201$2070202281068-0700</exceptionTimestamp>
<exceptionDetail>NO DATA AVAILABLE FOR TIME PERIOD SPECIFIED =</exceptionDetail>
這些條目忽略,因爲它含有Mo重於一個特殊字符(包括空格)。任何人都可以請給我一個正確的正則表達式爲上述情況。 謝謝。
您是否試圖簡單地查找該行是否匹配,或者您是否嘗試用反向引用發現違規字符? – 2012-07-19 10:50:31