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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -