I have expression like this and I want match only digits inside the parenthesis just after from totalamount and minamount
"test test test test totalamount(32604) > 0m)"
"test test test test totalamount(32604, 13456) > 0m)"
"test test test test minamount(32604) > 0m)"
"test test test test minamount(32604, 34677, 12345) > 0m)"
So if I could have the right pattern my output should be
1- 32604
2- 32604, 13456
3- 32604
4- 32604, 34677, 12345
Regex regex = new Regex(@"(totalamount)\((\d*)(\,\d*)");
Regex regex2 = new Regex(@"(totalamount)\((\d*)(\d*)");
Regex regex3 = new Regex(@"(minamount)\((\d*)(\,\d*)");
Regex regex4 = new Regex(@"(minamount)\((\d*)(\d*)");
return regex.Match(expression).Success ? regex.Match(expression) :
regex2.Match(expression).Success ? regex2.Match(expression):
regex3.Match(expression).Success ? regex3.Match(expression) :
regex4.Match(expression).Success ? regex4.Match(expression) : null;
Here is my solution but thats the worst solution I think there must be better way to match my case. Can anyone help please ?