regex - regexp accepts either all numbers or all letters -


i need regexp works this: accepts strings made of numbers or letters (for example: "111111111111","aaaaaaaa", not "aaaaa11111").

i tried /(^[0-9]+$) | (^[a-z]$)/.test('111111111111'), not working though. what's right way ?

first, remove spaces, , second, [a-z] lacking +. so, working version is:

/(^[0-9]+$)|(^[a-z]+$)/ 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -