Help with usernames, PCRE-type regular expressions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kpmedia
    Member
    • Aug 2007
    • 42
    • 3.8.x

    Help with usernames, PCRE-type regular expressions

    Solution found.
    I chronicled what did/didn't work here: Prevent stupid ASCII usernames in vBulletin
    Hope that helps somebody, -KP


    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Need a little help here. I can see this, but it's either too much 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 would be?

    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.
    Last edited by kpmedia; Sun 4 Dec '11, 3:54pm. Reason: Updated info second time (Dec 2011), last update Jan 2011.
    ~
    ~ If you're using vB, you need a good host! Read my web hosting reviews.
    ~
    ~ Forum: Digital Video / Digital Photo / Web Design @ digitalFAQ.com
    ~ Forum: DVD & Blu-ray Collecting @ TVPast.org
    ~
  • kpmedia
    Member
    • Aug 2007
    • 42
    • 3.8.x

    #2
    EDIT: Solution found. See first post.
    Last edited by kpmedia; Sun 4 Dec '11, 3:56pm. Reason: Post unnecessary.
    ~
    ~ If you're using vB, you need a good host! Read my web hosting reviews.
    ~
    ~ Forum: Digital Video / Digital Photo / Web Design @ digitalFAQ.com
    ~ Forum: DVD & Blu-ray Collecting @ TVPast.org
    ~

    Comment

    • mschmid
      New Member
      • Feb 2010
      • 4
      • 4.0.0

      #3
      Originally posted by kpmedia
      Solution found.
      I chronicled what did/didn't work here: http://www.digitalFAQ.com/forum/show...scii-2823.html
      Thank you very much, this helped. Forbidding for example "@" as username (in the Illegal User Name field) will also prevent someone to register with a (dodgy) email address as username.

      Comment

      • eJM
        Senior Member
        • Sep 2004
        • 916
        • 3.8.x

        #4
        Andrés (vBSEO.com) had a working answer, but he forgot to include the $ at the end. I'm using it without the underscore and it works just fine.

        Jim
        If my post was helpful to you, please take the time to register at my forum and ask a question you've always wanted to know about floors.
        www.TheFloorPro.com

        Comment

        • kpmedia
          Member
          • Aug 2007
          • 42
          • 3.8.x

          #5
          Originally posted by mschmid
          Thank you very much, this helped. Forbidding for example "@" as username (in the Illegal User Name field) will also prevent someone to register with a (dodgy) email address as username.
          Hey, thanks for posting a reply, and letting me know it helped you.

          Do notice that I had already included the @ symbol, because I don't consider email addresses to be a "username" either. As you mentioned, it's often dodgy. In other cases, it's just naive actions, and will lead to somebody getting their address harvested. And that's no good. (Tip: Use htaccess or web.config to block known harvester IP/bots.)

          @eJM, I could never get vBSEO.com advice to work. To hazard a guess, it could be some bug specific to the exact combo of vB + vBSEO where it was attempted. Noting that I did get it to function at another forum on a different exact version.

          Glad that I could help somebody, and give back to vB.com.
          ~
          ~ If you're using vB, you need a good host! Read my web hosting reviews.
          ~
          ~ Forum: Digital Video / Digital Photo / Web Design @ digitalFAQ.com
          ~ Forum: DVD & Blu-ray Collecting @ TVPast.org
          ~

          Comment

          • eJM
            Senior Member
            • Sep 2004
            • 916
            • 3.8.x

            #6
            Originally posted by kpmedia
            @eJM, I could never get vBSEO.com advice to work.
            As I said, it was prob'ly the missing $ sign. If you have vBulletin forum 3.8.x, that expression does work. It just has to be complete:

            Code:
            ^[a-zA-Z0-9\.-_\s]+$
            By the way, your website has one of those stupid warnings that my browser is out of date. They don't work and it's irritating. I have the latest version of IE9 and it's telling me to upgrade to IE8??? Yeah, RIGHT!
            If my post was helpful to you, please take the time to register at my forum and ask a question you've always wanted to know about floors.
            www.TheFloorPro.com

            Comment

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