c# - How to find a repeated string and the value between them using regexes? -
How do you repeat the value of the string and how will it get the data between using regsx? For example, take this piece of XML:
between the tag & lt; TagName & gt; Data & lt; / TagName & gt;
What would be the correct regex to find these values? (Note that tagname can be anything
)
I have found a way that works in which all tagname
s which is < Code> & lt; & Gt; and then at the end of the string looking for the first instance of tagName
from the opening tag and then concluding
EDIT: Please do not tell me to use XMLReader; I suspect that I will ever use my custom class to read XML, I am trying to figure out the best way to do this (and wrongly) through trying my own.
Thanks in advance.
You can use: & lt; (\ W +) & gt; (. *?) & Lt; \ 1 & gt;
The group is # 1 tag, the group # 2 is content.
Comments
Post a Comment