1

I wrote the following pattern:

@"<([0-9]+)>(.*?) < /$1>"

but it doesn't work. how could i refer to the first group?

source text:

"Method()<0>int x = 0; while(x < 10)<1>echo(x)< /1>< /0>"
Kobi
  • 135,331
  • 41
  • 252
  • 292
Kezziny
  • 13
  • 2
  • So, what you are looking for is the first number inside the angle brackets? And then you are also capturing the rest of the string? It would help if in your question you also included the exact text from your souce that you wish to capture. – saunderl Sep 16 '10 at 16:37
  • please refer to the following: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 ... it's not xml, but it's similar. The guy makes a valid point – DaveDev Sep 16 '10 at 16:39

1 Answers1

2

That would be \1, and watch for spaces.
See also: .Net Regex Backreferencing

Kobi
  • 135,331
  • 41
  • 252
  • 292