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

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -