1

How to edit Regex tag.

This is my code:

var target="<p><a href="<ers:redirectURL>xxx</ers:redirectURL>" target="_blank">sean</a></p>";

var mc = new Regex("<(\\s*/?\\s*([^\\s/>]+).*?)>").Matches(target);

only 5 value.

{<p>}
{<a href="<ers:redirectURL>}
{</ers:redirectURL>}
{</a>}
{</p>}

How can I get this 6 exact value?

{<p>}
{<a}
{<ers:redirectURL>}
{</ers:redirectURL>}
{</a>}
{</p>}

please help me how to edit Regex.

vegas red
  • 259
  • 4
  • 12

2 Answers2

1

For your example this would work:

<([^\s<>]+)>?

Your requirements are not clear, but this probably has many other issues.

Qtax
  • 33,241
  • 9
  • 83
  • 121
0

Another working example would be:

(</?[a-zA-Z:]*)>?
Alex Filipovici
  • 31,789
  • 6
  • 54
  • 78