Reputation: 2973
I have the following string:
{Name}({Age})
I want to get the following:
()
I have tried this code:
@"\{([^\}]+)\}" Only return {Name}
"({)(.*)(})" Return {Name}({Age}
But none of them worked as I wanted.
How to do this?
Upvotes: 2
Views: 246
Reputation: 9829
This should do it:
class Program
{
static void Main(string[] args)
{
string input = @"{Name}({Age})";
string output = Regex.Replace(input, @"\{.*?\}", "");
Console.WriteLine(output); // "()"
}
}
Upvotes: 3