Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular Expression with at least 1 letter and 1 number

I think it's simple but I am too dumb to write one. Can someone provide me with a regular expression that checks a given string for at least 1 letter and at least 1 number?

Also please give some explanation.

like image 846
Eros Avatar asked Dec 18 '22 07:12

Eros


1 Answers

REs aren't that good for very complicated things like multiple orders but this simple one should be representable with:

[A-Za-z].*[0-9]|[0-9].*[A-Za-z]
like image 177
paxdiablo Avatar answered Dec 21 '22 22:12

paxdiablo