13.05.2011, 06:58
(
Last edited by HP; 14/05/2011 at 03:58 PM.
)
I'm new to regular expressions, but might defining the amount of letters or numbers in "regex_match" fix Unknown123's problem? I'm assuming that if there isn't defined the number or characters, the default value is 1(one), so it will check for 1 character. I'm not sure about this, but maybe this will fix it? I might actually start reading more about it, when I get back home.
You can also leave the second number blank, so it well set only the minimal ammount of letters - {3, }. Just take a look at the examples brought out over here.
There is pretty much everything explained in the first post, but as I'm new to this, I don't know much about Regular Expressions. I'll learn it as soon as I have some time.
pawn Code:
#define IsValidText(%1) regex_match(%1, "[a-zA-Z0-9]{1,3}") // Minimal amount of characters is 1 and maximum of all is 3
// You can also check the length of the characters separated, if you want any number or letters to be in a specific length
#define IsNumber(%1) regex_match(%1, "[0-9]{2,4}") // Minimal amount of numbers is 2 and maximum of all is 4
There is pretty much everything explained in the first post, but as I'm new to this, I don't know much about Regular Expressions. I'll learn it as soon as I have some time.