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 and working between the data between them. However, it should be an easy way excessive is disabled and complex!

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

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -