javascript - String validation with regex in JS -
i need frame regex validate string format in javascript,
total length of string should between 3 , 30 characters length. first character must strictly alphabet. subsequent characters can either alphabet or dot or space. please help.
the following work you.
var re = /^[a-z][a-z. ]{2,29}$/i
regular expression:
^ # beginning of string [a-z] # character of: 'a' 'z' [a-z. ]{2,29} # character of: 'a' 'z', '.', ' ' (between 2 , 29 times) $ # before optional \n, , end of string
Comments
Post a Comment