javascript - Regexp: Check for digits and whitespaces -
i using following regexp make sure string contains 5 digits. works perfect, however, need allow whitespaces: 123 45 , 12345 need pass test.
string.match(/^\d{5}$/g); thanks
you remove whitespace , try match rest:
string.replace(/\s/g, "").match(/^\d{5}$/g)
Comments
Post a Comment