Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7949337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:58:07+00:00 2026-06-04T01:58:07+00:00

I am looking for a regex to create a string of characters with the

  • 0

I am looking for a regex to create a string of characters with the following criteria:

  • Can be variable length (max 30 characters)
  • Can have only alphanumeric (a-z,A-Z) and Numeric characters(0-9)
  • Can have only these special characters “-“,”.” anywhere in the string
  • Must start with only alphanumeric or numeric, not special characters
  • Must be at least 5 characters

The “badge” string will need to be used in the url of the site, any advice on whether this string would be alright would be appreciated.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T01:58:09+00:00Added an answer on June 4, 2026 at 1:58 am

    RegExp’s do not create strings they are used to validate or match them. Is that what you mean?

    A RegExp to validate a string against your constraints would be

      /^[a-z0-9][-,\.a-z0-9]{4,29}$/i
    

    Explanation :

       /^                  Start of string
       [a-z0-9]            One character in the set a-z or 0-9 
                           (A-Z also valid since we specify flag i at the end
       [-,\.a-z0-9]{4,29}  A sequence of at least 4 and no more than 29 characters
                           in the set. Note . is escaped since it has special meaning
       $                   End of string (ensures there is nothing else
       /i                  All matches are case insensitive a-z === A-Z
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam looking for Regex which can accept values between 1 and 250 .The Following
I am looking for a regex to validate a string. I want to allow
I'm looking for a regex statement to verify a string is exactly 2 lines.
I'm trying to create a regex containing character set which can contain a period
<a href=/search?hl=en&amp;pwst=1&amp;sa=X&amp;ei=RCPqTqkHycryA_bK_f0J&amp;ved=0CCUQvwUoAQ&amp;q=psychology&amp;spell=1 class=spell><b><i>psychology</i></b></a> Hi, I'm looking to create a regex which matches this anchor
Im looking for regex for usernames I want to allow: only ASCII only -
I'm looking for a regex to search my python program to find all lines
I'm looking for a regex to remove all trailing asterisks and all asterisks inside
I'm looking for some regex/automata help. I'm limited to + or the Kleene Star.
I need some help. I am looking for a regex that would match the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.