对不起,我是PHP新手。我试图匹配一个字符串的模式,但无论我做什么,我都没有得到匹配。我想我在做错模式。此外,有时我得到'未知修饰符'错误。下面是主题字符串:preg_match返回未知修饰符
<soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:body>
<sendtransactionsactionresponse xmlns="http://tempuri.org/">
<sendtransactionsactionresult>113</sendtransactionsactionresult>
</sendtransactionsactionresponse>
</soap:body>
</soap:envelope>
我试图匹配整个<sendtransactionsactionresult>XXX</sendtransactionsactionresult>
模式,其中XXX为3位数字字符。这里是我迄今为止尝试过的模式:
@<sendtransactionsactionresult>[0-9]<\/sendtransactionsactionresult>@i
/<sendtransactionsactionresult>[0-9]<\/sendtransactionsactionresult>/
@(\<[a-z]\>[0-9]\<\/[a-z]\>)@i
/<[a-z]>[0-9]</[a-z]>/
and many many more..
没有一个匹配那..我做错了什么?
是否有理由不使用比正则表达式更合适的工具? (Xpath,整个dom扩展名)? – Rangad
好吧,我试图使用它们,但没有任何帮助..当我使用'print_r'时,我总是得到一个空对象。 http://stackoverflow.com/questions/32799614/how-to-get-a-value-from-soap-response-using-php – Abhik