RegEx to get text within tags


I need a Regular Expressions to get the text within 2 tags.

Lets say I want an array returned containing any text within <data> and </data> tags.
Or any text within "(" and ")" tags.

How can I do that with RegEx's in C#?

An advanced question would be:

  1. The input string is "color=rgb(50,20,30)"
  2. How can I get the 3 numbers in 3 seperate array slots as returned by the RegEx processor in C#?

Best Solution

Perl regexp would be

$string =~ /color=rgb\((\d+),(\d+),(\d+)\)/;
@array = ($1,$2,$3);

But you probably need more information that this.