No announcement yet.

Define complex Regular Expression

  • Filter
  • Time
  • Show
Clear All
new posts

  • Define complex Regular Expression


    I want to create a regular expression for the username field on registration, that disallow users from using certain words, and some characters limitations.

    By seaching the forums I have found some expressions that could help me, but I'm not sure about the right way to combine it together.

    (?!^term1$)^[a-zA-Z0-9 _-]+$
    I think, this should disallow from people to use the word "term1" and to force them to use this only characters.
    If then, I want to add here also "term2" as a forbidden string.

    Can you organize it for me plz?

    Thank you.

  • #2
    Don't try using regex to disallow usernames. This is already available in your AdminCP.

    AdminCP > vBulletin Options > vBulletin Options > User Registration Options > Illegal User Names


    • #3
      Nice, I guess that you understood what am I planning, cause you have replyed on my second question.
      But as like there, you are trying to avert me from a true solution by compromise and using common options on my system.

      So, like you have already indicated, I want to use the regex to disallow usernames. The option that available in AdminCP is useless for my needs, as I explained here.
      Can you, or anybody else help and tell me how to do that?

      Thanks anyway.


      • #4
        This requires custom coding which we cannot officially support. Try asking for help with this at the vB Mod site:


        • #5
          Give me a favor! Don't rubbish me with that sentence.
          I have not asked to code some custom code in the system!

          I asked only for some help with that regex thing, for use in the username field on registration at AdminCP.

          This regex works alone:
          This regex works alone too:
          And this regex, also works alone:
          ^[[COLOR=Red]a-zA-Z0-9 _-[/COLOR]]+$
          I want to know how to connect all these three together. That's all!


          • #6
            Regex is custom coding.

            Help with Customizing vB


            • #7
              Even when it's on a regular field at AdminCP?
              I don't understand why it's different from any other functions there.

              sorry for bothering you.


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