Guy Hengel [angelIII / a3]
asked on
Regex pattern from "xml" like stuff
say we have this string:
parts.
my first tries was:
I think this should be quite obvious ...
note: I won't care about people telling me to parse this with xml document or the like ...
I know the arguments, and have my reasons to work like this ...
thanks
<sql>abc</sql><parameter><name>smsc</name><value>62000</value></parameter><parameter><name>msisdn</name><value>123456789</value></parameter><parameter><name>message</name><value>test proc</value></parameter><parameter><name>sourcename</name><value>test</value></parameter>
I want with the Regex.Matches to return the MatchCollection to return all the <parameter>...</parameter>my first tries was:
<parameter>(.*)</parameter>
which returns this:<parameter><name>smsc</name><value>62000</value></parameter><parameter><name>msisdn</name><value>123456789</value></parameter><parameter><name>message</name><value>test proc</value></parameter><parameter><name>sourcename</name><value>test</value></parameter>
matching the first <parameter> with the last </parameter> :(I think this should be quite obvious ...
note: I won't care about people telling me to parse this with xml document or the like ...
I know the arguments, and have my reasons to work like this ...
thanks
Consider working with xpath instead of regex. See article: https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XML/XPath/A_9856-Retreive-specific-parts-of-HTML-documents-without-the-hassle-of-monster-regular-expressions.html
ASKER
with due respect, but I thought I had made clear that:
note: I won't care about people telling me to parse this with xml document or the like ...
I know the arguments, and have my reasons to work like this ...
note: I won't care about people telling me to parse this with xml document or the like ...
I know the arguments, and have my reasons to work like this ...
Your choice...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
small but efficient change.
thanks!
thanks!