Regular Expression To Match Comma Separated Numbers

Category: Numbers

Comma-separated numbers is the problem that many people face. Regular Expression allows you to match comma-separated-values, which gives you the flexibility to extract your data.

This is a regular expression to simply match and valid comma-separated numbers in your data. I hope this Regular Expression will help people who have been finding a solution for matching comma-separated values.

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

Matches:

  • 1
  • 12
  • 1,2,3

Non-matches:

  • 1.2.3
  • a,b,c
  • abc

See Also:

Rate The Regex
Sending
User Review
0 (0 votes)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.