Regex to validate phone numbers, making sure there are no letters in them -


we have live project , need filter out letters phone numbers, using regex.

being live, cannot fiddle it, thinking of regex:

^[^a-za-z]*$ 

do think trick? eliminate phone numbers contains letters?

being multicultural site, know of country uses letters in phone numbers?

cheers!

based on current regex, assuming need regex match valid inputs.

your current regex work fine prevent letters, think make more sense figure out minimum set of characters consider valid , create regex that.

for example if want allow digits use ^\d*$ or ^[0-9]*$.

to allow spaces, hyphens, , parentheses number (123) 456-7890 valid:

^[\d \-()]*$ 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -