1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Regular Expression Usernames

Discussion in 'XenForo Questions and Support' started by destring, Nov 29, 2010.

  1. destring

    destring New Member

    I was wondering if someone could help me with the regular expression usernames. I only want to allow letters, numbers, and underscores. Any help would be greatly appreciated.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Try this: ^[a-zA-Z0-9_]+$

    I was almost there, just needed a bit of help from Mike (I omitted the [] and +$).
  3. destring

    destring New Member

  4. Andy.N

    Andy.N Well-Known Member

    If I allow only letters, period (.), space, underscore and -, then what would that be?
  5. Mike

    Mike XenForo Developer Staff Member

    I'm not checking this, but...

    ^[a-zA-Z. _-]+$
    Andy.N likes this.

Share This Page