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

  • Home
  • SEARCH
  • 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 6228915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:28:17+00:00 2026-05-24T09:28:17+00:00

I need regex that validates a string that: has 4 or 5 letters then

  • 0

I need regex that validates a string that:

  • has 4 or 5 letters
  • then one underscore
  • then either an I or O (only one of them)
  • then one underscore
  • then 4 numeric digits

Now here where it complicates further.
After all that it may have:

  • another underscore
  • then 4 numeric digits.

In the end all these must be valid:

ASDF_I_0002

ASDFG_O_0003_0324

ASDF_O_0001

ASDF_I_0001_0001

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-05-24T09:28:19+00:00Added an answer on May 24, 2026 at 9:28 am
    • has 4 or 5 letters (A-Z)

      [A-Z]{4,5}
      
    • then one underscore

      [A-Z]{4,5}_
      
    • then either an I or O (only one of them)

      [A-Z]{4,5}_[IO]
      
    • then one underscore

      [A-Z]{4,5}_[IO]_
      
    • then 4 numeric digits

      [A-Z]{4,5}_[IO]_[0-9]{4}
      

    After all that it may have:

        [A-Z]{4,5}_[IO]_[0-9]{4}()?
    
    • another underscore

      [A-Z]{4,5}_[IO]_[0-9]{4}(_)?
      
    • then 4 numeric digits.

      [A-Z]{4,5}_[IO]_[0-9]{4}(_[0-9]{4})?
      

    You’ve lined out your requirements so nicely, I wonder where the problem was to make a regex from them. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a regex or a function in PHP that will validate a string
I need a regex that also matches Chinese, Greek, Russian, ... letters. What I
I need a regex pattern that validates IP addresses. This is easy enough to
Really got stuck on this simple regex. Need it to validate a string, that
I need a Regex Statement (run in c#) that will take a string containing
I need a regex that would validate first 4 digit set and then 3
I need a Regex that will match a java method declaration. I have come
I need a regex that matches all strings ending in .cs, but if they
I need a regex that matches the following (the brackets indicate I want to
I need a regex that will give me the following results from each example

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.