I have a below XML file
<configs>
<config environment="DEV">
<URL>http://www.devurl.com</URL>
</config>
<config environment="SIT">
<URL>http://www.siturl.com</URL>
</config>
<config environment="UAT">
<URL>http://www.uaturl.com</URL>
</config>
<config environment="PROD">
<URL>http://www.produrl.com</URL>
</config>
</configs>
and am trying to write a regex to find the URL value that is configured for PROD environment. Below is my sample Regex
var regexp = /<config environment="PROD">[^]*?<\/config>/gi;
var matches_array = data.match(regexp);
console.log(matches_array[0]);
which returns
<config environment="PROD">
<URL>http://www.produrl.com</URL>
</config>
as a result, but i expect my regex should return URL tag alone as a result for eg :
<URL>http://www.produrl.com</URL> or http://www.produrl.com
Can any one help me to get this work.
Thanks in advance..!
via Mohan
No comments:
Post a Comment