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 9221271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:32:32+00:00 2026-06-18T03:32:32+00:00

I have a really simple question (punny right). What is the simplest form of

  • 0

I have a really simple question (punny right).

What is the simplest form of this regular expression?

(((0|1)*(00)(0|1)*)((0|1)*(11)(0|1)*))|(((0|1)*(11)(0|1)*)((0|1)*(00)(0|1)*))

I’m creating a regular expression that accepts a language for all binary strings that contain the substrings 00 and 11 (in any order).

The expression I have now works, but I’m sure it can be simplified.

  • 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-18T03:32:33+00:00Added an answer on June 18, 2026 at 3:32 am

    This is almost the same regex. I only converted the (0|1) into [01], added a [01]* to the left and right shared for both cases (11 first or 00 first) and removed some parenthesis that were not necessary:

    [01]*(00[01]*11|11[01]*00)[01]*
    

    Steps to reproduce

    1. Stating with

      (((0|1)*(00)(0|1)*)((0|1)*(11)(0|1)*))|(((0|1)*(11)(0|1)*)((0|1)*(00)(0|1)*))
      __^^^^^_____^^^^^___^^^^^_____^^^^^______^^^^^_____^^^^^___^^^^^_____^^^^^___

    2. Replace all (0|1) by [01]

      (([01]*(00)[01]*)([01]*(11)[01]*))|(([01]*(11)[01]*)([01]*(00)[01]*))
      _______^^^^____________^^^^_______________^^^^____________^^^^_______

    3. Remove parenthesis around (00) and (11) as you do not want to capture this group and you do not have a *, +, ? behind the parenthesis. Therefore it is not required because of ambiguity.

      (([01]*00[01]*)([01]*11[01]*))|(([01]*11[01]*)([01]*00[01]*))
      _^____________^^____________^___^____________^^____________^_

    4. Remove yet more parenthesis that does not solve any ambiquity:

      ([01]*00[01]*[01]*11[01]*)|([01]*11[01]*[01]*00[01]*)
      ________^^^^^^^^^^_________________^^^^^^^^^^________

    5. Collapse [01]*[01]* into [01]* which means exactly the same.

      ([01]*00[01]*11[01]*)|([01]*11[01]*00[01]*)
      _^^^^^_________^^^^^___^^^^^_________^^^^^_

    6. Extract common prefix and suffix [01]*

      [01]*(00[01]*11|11[01]*00)[01]*

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

Sidebar

Related Questions

This is a (hopefully) really simple question - I have been told recently that
A really simple shell script question. I have a file with something like this:
This is a really simple question and I'm suprised I have to ask it
Um, probably a really simple question, but I just noticed that I have no
another fun (and probably really simple) question for you, that I have half worked
I have a really, really simple CSS question that has already been asked here
This is a really simple question which I'm struggling with. I have a variable
Really simple question: Am I missing something? Seems like this should be all that
this sounds like a really simple question but could easily have a very complicated
This should be a really simple question, but I'm still having difficulty. I have

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.