javascript - regular expression to match one dot or three dot validator -
in field want allow 1 dot or 3 dot
for 3 dot regex working
/^[a-za-z]+[.]{3}$/ but try 1 , 3 both not work. try | (or) sign
/^([a-za-z]+[.]{1})|([a-za-z]+[.]{3})$/ thanks in advance
thanks again working want allow below options
means 1 0r 3 dot in word not 2,4,5 dot.
1) m.c.a 2) m.c.a... 3) m...ca. below regex works above requirement
/^([a-za-z]+(\.|\.\.\.)([a-za-z]+)?)+$/
you simplify or statement 1 group, example
^[a-za-z]+(\.|\.\.\.)$ this match number of characters ending either . or ...
Comments
Post a Comment