Username Regular Expression PCRE Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Neutral Singh
    Senior Member
    • Sep 2004
    • 232
    • 3.8.x

    Username Regular Expression PCRE Help

    i am presently using: ^[A-Z0-9 ]+$
    which means: Alphanumeric characters including space

    Now, i want an expression where besides above condition, nobody is allowed to register with numeric only username.

    e.g.

    username:
    abcdef is perfectly fine!
    abc123 is perfectly fine!

    but username:
    123456 should not be allowed!

    What would be the regular expression?

    Thanks

  • Nirjonadda
    Member
    • Dec 2011
    • 65
    • 4.2.X

    #2
    I am also still looking for it, Anyone help please.

    Comment

    • kh99
      Senior Member
      • Aug 2009
      • 533

      #3
      Well, you could use this:
      Code:
      [^0-9]
      which just says that there has to be at least one non-number somewhere in the name. Note that that doesn't do what the first poster asked for because it doesn't limit the characters to letters, numbers, and spaces. But I saw your other thread and I don't think you asked for that, so maybe this will work for you.

      Edit: I think this will work if you want to limit the allowed characters, but also prevent all numbers:
      Code:
      ^[A-Z0-9_ -]*[A-Z_ -]+[A-Z0-9_ -]*$
      This example allows letters, numbers, and _, -, space, but not all numbers. (Note that if you want to allow '-', then it has to be listed last in the brackets, or else it will cause an error).
      Last edited by kh99; Fri 1 May '15, 6:28am.

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...