Help me to validate my RegEx code.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cyber Fucker
    Hmm
    • Sep 2005
    • 12642

    #1

    Help me to validate my RegEx code.

    I want it to match all alphanumeric characters (digits and letters, uppercase and lowercase), spaces " ", underscores "_", dashes "-", and dots "." and it should be at least 3 characters long and not more than 32 characters long.

    Would it be..

    ^[A-Z0-9.-_]{3,32}+$

    ^[A-Z0-9.-_]{3,32}$

    ^[A-Za-z0-9.-_]{3,32}+$

    ^[A-Za-z0-9\.\-_]{3,32}+$

    Which one would be correct if any (I need it for vbulletin forms) ?
    Thank you in advance for the help.
  • Cyber Fucker
    Hmm
    • Sep 2005
    • 12642

    #2
    No one? I have thought this was webmaster board.

    Comment

    • Cyber Fucker
      Hmm
      • Sep 2005
      • 12642

      #3
      last bump

      Comment

      • Juicy D. Links
        So Fucking Banned
        • Apr 2001
        • 122992

        #4
        1+1 =2

        ----

        Comment

        • woj
          <&(©¿©)&>
          • Jul 2002
          • 47882

          #5
          E. none of the above
          Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
          Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
          Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

          Comment

          • anicetan
            Registered User
            • Mar 2003
            • 73

            #6
            I think #4 is the closest. I don't think the minus sign is a metacharacter, so you don't need to escape it. I also don't think you need the plus sign before the dollar sign. Thus I end up with:

            ^[A-Za-z0-9\.-_]{3,32}$

            Good luck
            Last edited by anicetan; 01-21-2010, 07:03 PM.

            High Quality - Low Prices

            Comment

            • fatfoo
              ICQ:649699063
              • Mar 2003
              • 27763

              #7
              I don't know what you are talking about.
              Send me an email: [email protected]

              Comment

              • borked
                Totally Borked
                • Feb 2005
                • 6284

                #8
                Originally posted by anicetan
                I don't think the minus sign is a metacharacter, so you don't need to escape it.

                ^[A-Za-z0-9\.-_]{3,32}$

                Good luck
                If the minus sign isn't a metacharacter, then what is it doing in eg A-Z and a-z and 0-9???

                Of course it needs escaping

                ^[A-Za-z0-9\.\-_ ]{3,32}$

                or shorter still
                ^[\w\.\-]{3,32}$
                note with this though, \w as it's recognising word characters, will allow tabs and line breaks, not just white space.... if you don't want them, negate them:
                ^[\w\.\-^\t^\n]{3,32}$

                For coding work - hit me up on andy // borkedcoder // com
                (consider figuring out the email as test #1)



                All models are wrong, but some are useful. George E.P. Box. p202

                Comment

                • StaceyJo
                  Confirmed User
                  • Mar 2008
                  • 8960

                  #9
                  Originally posted by borked
                  If the minus sign isn't a metacharacter, then what is it doing in eg A-Z and a-z and 0-9???

                  Of course it needs escaping

                  ^[A-Za-z0-9\.\-_ ]{3,32}$

                  or shorter still
                  ^[\w\.\-]{3,32}$
                  note with this though, \w as it's recognising word characters, will allow tabs and line breaks, not just white space.... if you don't want them, negate them:
                  ^[\w\.\-^\t^\n]{3,32}$
                  Good info. Thanks,
                  /_______ WebCashMaker ______\
                  | _TeenageDecadence - Young Board Naked Teens. |
                  | ____ NonNudeGirls - Female Puberty Photos. ____ |
                  | _ HerSelfPics - The ORIGINAL exGF SelfPic site. __ |
                  \.______ xPosing - Wife Photosharing site. _______./

                  Comment

                  • Cyber Fucker
                    Hmm
                    • Sep 2005
                    • 12642

                    #10
                    Originally posted by borked
                    If the minus sign isn't a metacharacter, then what is it doing in eg A-Z and a-z and 0-9???

                    Of course it needs escaping

                    ^[A-Za-z0-9\.\-_ ]{3,32}$

                    or shorter still
                    ^[\w\.\-]{3,32}$
                    note with this though, \w as it's recognising word characters, will allow tabs and line breaks, not just white space.... if you don't want them, negate them:
                    ^[\w\.\-^\t^\n]{3,32}$
                    Thank you! You restore my faith in webmater occurrence on this board.

                    Comment

                    Working...