Regular Expression to match only odd or even number

Odd Numbers

"^\d*[13579]$"

Even Numbers

"^\d*[02468]$"

Run of Odds with a , and potential whitespace separator

"$\s*(\d*[13579]\s*,\s*)*\d*[13579]$"

Run of Evens with a , and potential whitespace separator

"$\s*(\d*[02468]\s*,\s*)*\d*[02468]$"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)