Reputation: 152
I'm looking to pull a the name of a web service from SOAP requests. Basically the calls look something along the lines of:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.address.com">
<soapenv:Header/>
<soapenv:Body>
<ws:webServiceName>
.
.
.
</ws:webServiceName>
</soapenv:Body>
</soapenv:Envelope>
I've tried a few regexs but I can't seem to pull just the name correctly, I'd like to ignore the <ws:
before the name, as well as the >
character at the end. The regex: <ws=([^>]+)
almost works, but will match <ws:webServiceName
Any ideas.? Thanks
Upvotes: 0
Views: 1303
Reputation: 48807
If the regex flavor you're using supports lookbehinds (in this case positive lookbehinds, i.e. (?<=...)
), this one should suit your needs:
(?<=<ws:)[^>]+
Upvotes: 2