Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use the following regex pattern to match only numbers and commas:

^[0-9,]+$

This pattern matches any string that contains only digits and commas. The ^ and $ characters mark the beginning and end of the input string, respectively. The + sign means that one or more of the preceding characters or character sets are allowed, and [0-9,] matches any digit or comma.