Welcome Guest, Not a member yet? Register   Sign In
Regex help

Can someone please help me, my regular expression is not doing what I need it to do.
What I need is 4 characters, a-z uppercase or lowercase, followed by at least 1 digit to inifinite amount of digits. Current I have:

It's weird, test cases I've tried:

ssss2 - Succeed
ssss2222 - Succeed
s2 - Fail
sss2 - Fail
s2323424 - Succeed

Seems its treating \w to work even if digits are supplied, can anyone help me? Thank you.

instead of \w use [A-Za-z]

I thought I had tried that, apparently there is a big difference in putting A-Za-z inside of () brackets compared to [] brackets. Thanks for the help.

[eluser]Jamie Rumbelow[/eluser]
Just for clarification gigas, () tries to match everything it's contents. Square brackets [] specify a range of characters. If you don't know the difference, it can get pretty confusing!


[eluser]Sean Gates[/eluser]
For reference in this thread: if you are using a mac there is a great tool called RegExhibit. Works beautifully to quickly test and edit you regular expressions.

[eluser]Yorick Peterse[/eluser]
Untested, but should do the trick:


Theme © iAndrew 2016 - Forum software by © MyBB