regex - How to check on initials with html pattern? -
i'm making database can insert customers.
by initials of every forename want check if it's in right order. want as: "t.l.r." dots between every initial.
to check this, want use pattern.
what got this:
<input required="true" type="text" required pattern="[a-za-z]{1}+\.[a-za-z]{1}+\.[a-za-z]{1}+\.">
this code doesn't anything. know answer?
thanx in advance!
you combining {1}
means 1, , +
means 1 or more. not work.
try this:
[a-za-z]\.[a-za-z]\.[a-za-z]\.
since []
default means 1, can drop {1}
this mean need 3 characters in initials, i.k.
not count.
if want use 1 character, followed dot, , repeated can use this:
([a-za-z]\.)+
also, don't forget add prefix ^
postfix $
match whole string:
^([a-za-z]\.)+$
Comments
Post a Comment