0

I have a string like " test data \<tag1 attribute1="124" attribut2="abc"\> </tag>test end data"

I need sub string between "<tag1" and ">" as below:

"<tag1 attribute1="124" attribut2="abc">"

I have implemented below regex code for that:

var regex = new Regex("<tag1(.*)>");
var match = regex.Match(result);
var tagContent = match.Groups[1].Value;

Above did not help, it returned empty string.

Can anyone suggest me the right way of extracting content between "<tag1" and ">" using regex?

Rand Random
  • 6,067
  • 9
  • 36
  • 77
Akhil
  • 155
  • 1
  • 12

0 Answers0