Regular Expressions 101

Community Patterns

Check list of integers numbers separated by comma

1

Regular Expression
PCRE (PHP <7.3)

/
\s*[0-9]+(,\s*[0-9])*$
/
g

Description

Check list of integers numbers separated by comma

Ex: "1, 2, 4, 6" >> OK "99" >> OK "a, b, c" >> WRONG "3.14, 4" >> WRONG

Submitted by anonymous - 7 years ago