vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Help with usernames, PCRE-type regular expressions (https://vborg.vbsupport.ru/showthread.php?t=256844)

kpmedia 01-09-2011 10:14 PM

Help with usernames, PCRE-type regular expressions
 
Need a little help here, trying to limit usernames for new registrations.

I can see this in admincp vB options, but it's either too much filtering or not enough:
Code:

You may require the username to match a PCRE-type regular expression.
(Do not start or end the expression with an escape character)
Examples:
^[A-Z]+$ - Characters from A-Z only
^[A-Z ]+$ - Characters from A-Z including space
^[A-Z0-9 ]+$ - Alphanumeric characters including space
^((?!&#\d+;)[\x20-\x7E])+$ - ASCII characters from 32-127
See PHP.net for more information on regular expressions.

I want A-Z, 0-9, periods, underscore, spaces and hyphens --- and that's it.
Any help on what this syntax would be?


Also...

And if you know how...
Preferably no "repeat" periods/underscore/hyphen/spaces.
i.e., "--BESTUSEREVER-- ___ -- 123"
Better yet, limit to two total periods, underscores, hyphens, spaces
I don't want any more users trying to use screwball usernames full of ASCII.
Or even overusing what is allowable non-letter/non-number.

Thanks.

Lynne 01-09-2011 10:24 PM

Um, maybe:

^[A-Z0-9\._- ]+$

Really not sure exactly. I just added & and # to my list of illegal usernames.

kpmedia 01-23-2011 09:57 PM

Quote:

Originally Posted by Lynne (Post 2146693)
I just added & and # to my list of illegal usernames.

Brilliant idea. :)

I chronicled my findings on this issue at http://www.digitalFAQ.com/forum/show...scii-2823.html
And yours was the one that worked best.

Thanks.


All times are GMT. The time now is 02:33 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01874 seconds
  • Memory Usage 1,712KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete