Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Match price with multiple comma

Tags:

c#

regex

I want to match values having multiple comma in them. I'm able to match values with only 1 comma. regex: (\$\d+\,\d+) Example Value: $567,76 but i need to match this value $567,76,87 but this regex is not working.

like image 969
m.qayyum Avatar asked Feb 16 '23 17:02

m.qayyum


1 Answers

Try this pattern, maybe it could help.

^\$\d+(,\d+)*$

This will match on

$567
$567,76
$567,76,87

but not

$567,76,87,
  • Regex Demo (click on .Net button)
like image 159
John Woo Avatar answered Feb 28 '23 03:02

John Woo