Regex for at least one alphabet and shouldn't allow dot(.) -


i have written regex below i'm facing issue:

^[^\.]*[a-za-z]+$ 

as per above regex, df45543 invalid, want allow such string. 1 alphabet character mandatory , dot not allowed. other characters allowed.

you need use lookahead enforce 1 alphabet:

^(?=.*?[a-za-z])[^.]+$ 

(?=.*?[a-za-z]) positive lookahead makes sure there @ least 1 alphabet in input.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -