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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:25:32+00:00 2026-06-11T17:25:32+00:00

So, I want to built a regular expression that I can pass in a

  • 0

So, I want to built a regular expression that I can pass in a string of 0s and 1s (e.g. “0010101000111100100011110001101100011”) and then make sure that for every 6 consecutive characters, there needs to be at least two 1s in that block.

Also, strings less than length 6 should pass.

Examples of passing strings:

  • “”
  • “00”
  • “11000011”
  • “01010100”

Examples of failing strings:

  • “110000000011”
  • “000001”

These examples are of very small strings, but I want to build one to take any length string.

Now, I’m looking for a nice way to express this in a regular expression, rather than having solution with a loop and such.

  • 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-11T17:25:33+00:00Added an answer on June 11, 2026 at 5:25 pm

    Just use this regex and check that it doesn’t match:

    /000000|000001|000010|000100|001000|010000|100000/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an regular expression built in Java. String expr = <a.*?id=\(pres.*?)\.*?>Discharge.*?Medications:</a>; I want
I want to pass a pre-built Map to multiple threads that are going to
I have a complex regular expression I've built with code. I want to normalize
I need to build ONE regular expression that can detect ALL the following strings
I have a string like that : 0d(Hi)i(Hello)4d(who)i(where)540d(begin)i(began) And i want to make it
I just want to create a regular expression out of any possible string. var
I have a user supplied string, that I then need to turn into a
I'm trying to create regular expression that filters from the following partial text: amd64
I am trying to create a regular expression that would easily replace an input
I am trying to build a regular expression that does matches only string2 below.

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.