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
Post a Comment