Regular Expressions 101

Community Patterns

Matches a number sequence separated by a comma: 1234,1234,1234,1234

0

Regular Expression
PCRE (PHP <7.3)

/
^((?:[0-9]+,{1}?)+[0-9]+)$
/
g

Description

Matches a number sequence separated by a comma: 1234,1234,1234,1234

won't match:

  • Letters
  • If sequence ends with a comma
  • If sequence has double comma's.
Submitted by Jordy van Domselaar <jordy.van.domselaar@outlook.com> - 6 years ago