SA-MP Forums Archive
[REGEX] Acceptable nickname regular expression - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [REGEX] Acceptable nickname regular expression (/showthread.php?tid=411634)



[REGEX] Acceptable nickname regular expression - ikkentim - 29.01.2013

Hi,

I'm programming some user interface in PHP, and I'm having a little problem with acceptable nicknames.

I know these are the accepted characters:
a-z A-Z 0-9 . _ $ @ = ( ) [ ].

and you need 3-20 characters. (can be done with strlen)

Does anyone have a regular expression laying around or knows how to make a regex for checking if any other characters than those allowed are posted($username)?


Re: [REGEX] Acceptable nickname regular expression - Vince - 29.01.2013

Not too good with regex, but I think it's basically just this:

Code:
^[A-Za-z0-9\._\$@=\(\)\[\]]+$