GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Help me to validate my RegEx code. (https://gfy.com/showthread.php?t=949574)

Cyber Fucker 01-21-2010 10:55 AM

Help me to validate my RegEx code.
 
I want it to match all alphanumeric characters (digits and letters, uppercase and lowercase), spaces " ", underscores "_", dashes "-", and dots "." and it should be at least 3 characters long and not more than 32 characters long.

Would it be..

^[A-Z0-9.-_]{3,32}+$

^[A-Z0-9.-_]{3,32}$

^[A-Za-z0-9.-_]{3,32}+$

^[A-Za-z0-9\.\-_]{3,32}+$

Which one would be correct if any (I need it for vbulletin forms) ?
Thank you in advance for the help. :helpme

Cyber Fucker 01-21-2010 04:18 PM

No one? I have thought this was webmaster board. :helpme

Cyber Fucker 01-21-2010 08:20 PM

last bump

Juicy D. Links 01-21-2010 08:30 PM

1+1 =2

----

woj 01-21-2010 08:50 PM

E. none of the above

anicetan 01-21-2010 09:01 PM

I think #4 is the closest. I don't think the minus sign is a metacharacter, so you don't need to escape it. I also don't think you need the plus sign before the dollar sign. Thus I end up with:

^[A-Za-z0-9\.-_]{3,32}$

Good luck :thumbsup

fatfoo 01-21-2010 09:03 PM

I don't know what you are talking about.

borked 01-22-2010 12:40 AM

Quote:

Originally Posted by anicetan (Post 16771640)
I don't think the minus sign is a metacharacter, so you don't need to escape it.

^[A-Za-z0-9\.-_]{3,32}$

Good luck :thumbsup

If the minus sign isn't a metacharacter, then what is it doing in eg A-Z and a-z and 0-9???

Of course it needs escaping :winkwink:

^[A-Za-z0-9\.\-_ ]{3,32}$

or shorter still
^[\w\.\-]{3,32}$
note with this though, \w as it's recognising word characters, will allow tabs and line breaks, not just white space.... if you don't want them, negate them:
^[\w\.\-^\t^\n]{3,32}$

StaceyJo 01-22-2010 01:11 AM

Quote:

Originally Posted by borked (Post 16772119)
If the minus sign isn't a metacharacter, then what is it doing in eg A-Z and a-z and 0-9???

Of course it needs escaping :winkwink:

^[A-Za-z0-9\.\-_ ]{3,32}$

or shorter still
^[\w\.\-]{3,32}$
note with this though, \w as it's recognising word characters, will allow tabs and line breaks, not just white space.... if you don't want them, negate them:
^[\w\.\-^\t^\n]{3,32}$

Good info. Thanks, :)

Cyber Fucker 01-22-2010 06:38 PM

Quote:

Originally Posted by borked (Post 16772119)
If the minus sign isn't a metacharacter, then what is it doing in eg A-Z and a-z and 0-9???

Of course it needs escaping :winkwink:

^[A-Za-z0-9\.\-_ ]{3,32}$

or shorter still
^[\w\.\-]{3,32}$
note with this though, \w as it's recognising word characters, will allow tabs and line breaks, not just white space.... if you don't want them, negate them:
^[\w\.\-^\t^\n]{3,32}$

Thank you! You restore my faith in webmater occurrence on this board. :thumbsup


All times are GMT -7. The time now is 07:17 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123