vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Username Regular Expression (https://vborg.vbsupport.ru/showthread.php?t=303180)

induslady 10-09-2013 04:04 PM

Username Regular Expression
 
Hello,
In my board, have the below setting -

User Registration Options > Username Regular Expression - ^[A-Z0-9]+$

so that it allows alpha numeric characters in user names.

But am looking for expression that does not allow user names that has ONLY numbers like - "12345".

How do I set this?

Thanks in advance.

kh99 10-09-2013 04:47 PM

I found this: ^\d*[a-zA-Z][a-zA-Z0-9]*$

here: http://stackoverflow.com/questions/1...-one-character. It allows lower case, but you could take out the lower case ranges if you want (or I guess it doesn't matter to vbulletin).

induslady 10-10-2013 03:24 AM

Hello Kh99,
Thanks for the response. Yes it seems to be working good but I would also want to disallow user names that starts with numbers like - "1234test". In such a scenario how do you think the regex need to be?

Do you think this will work -
^[a-zA-Z][a-zA-Z0-9]+$

kh99 10-10-2013 09:50 AM

Yes, I believe you'd just want to remove the \d* from the beginning. You could change the last * to + as you've done, but I think that would just require the username to be at least 2 characters, and vbulletin already requires at least 3.

induslady 10-11-2013 03:00 AM

Thanks Kh99,
It did work good.


All times are GMT. The time now is 11:21 PM.

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.01827 seconds
  • Memory Usage 1,713KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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