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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:36:15+00:00 2026-06-11T21:36:15+00:00

Good day stack overflow. I’m a noob in using regex and here is my

  • 0

Good day stack overflow.

I’m a noob in using regex and here is my problem – I need to check a password if it contains 4 consecutive characters. so far what I have just covered is regarding the digits. Here is my regex:

ascending digits – ^.?(?:0123|1234|2345|3456|4567|5678|6789).$

descending digits – ^.?(?:9876|8765|7654|6543|5432|4321|3210).$

This works only for the digits. I know this is already an overkill in regex so I dont want to do it with the letters. It will be waaay too overkill if I do that.

abcdblah //true because of abcd

helobcde //true because of bcde

dcbablah //true beacause of dcba

heloedcb //true because of edcb

Any help would be highly appreciated. Thanks stackoverflow.

  • 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-11T21:36:16+00:00Added an answer on June 11, 2026 at 9:36 pm

    here is an idea that doesn’t use regex:
    all characters have an ansi value and usually consecutive. so abcd should have let’s say the following ansi values:64,65,66,67

    pseudocode:

    for (i=string.start;i<string.end-4;i++) {
       check=string.substring(i,4);
       c1=check.substring(0,1);
       c2=check.substring(1,1);
       c3=check.substring(2,1);
       c4=check.substring(3,1);
       if (c1.ansival==c2.ansival+1 && c2.ansival==c3.ansival+1 && c3.ansival==c4.ansival+1) {
          return false;
       } else {
          return true;
       }
    }
    

    also repeat in reverse order (c1.ansival+1==c2.ansival) for descending order

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

Sidebar

Related Questions

Good day, I've read a few other stack overflow postings and other tutorials, but
Good day. I need to teach Windows CryptoAPI to encrypt the message with private
Good day, I have like 15 images I need to be buttons. I have
Good day everyone! I am trying to understand how buffer overflow works. Right now,
Good day stack people, I'm doing research for my self on how to combine
Good Day All, I’m new to programming. I’m using Visual Studio 2010. I’m taking
Good day, i will try to explain my problem as best as i can.
Good day, stackoverflow, I need to suggest to user different contexts for a word,
Good day, after struggling with a problem at my previous post, i entered another
Good day! I've found interesting behaviour for both LAMP stack and ASP.NET. The scenario:

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.