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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:59:07+00:00 2026-06-02T10:59:07+00:00

Have searched for my solution on google and finally decided to post a question

  • 0

Have searched for my solution on google and finally decided to post a question here.

My requirement is to send only A C and R characters as input and the maximum length of the string passed should not be more than 6 characters.

Following are the valid states:

A,C,R,

A,R,C,

R,A,C,

R,C,A,

C,R,A,

C,A,R,

R,C,

C,R,

A,R,

R,C,

A,

……

and so on. All possible combinations of A, C, R, are possible but the maximum lenght should not increase 6 char.

So far I am able to perform pattern validation like ([ACR],)+ but also want to perform size validation in same regex.

So for now, I’m using condition like

if(!status.matches("([ACR],)+") || status.length()>6){
SOP
}

This implementation of size I have to use across multiple methods.

Thanking in advance.

  • 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-02T10:59:09+00:00Added an answer on June 2, 2026 at 10:59 am

    This regex will allow a pattern to be repeated between 1 and 3 times (in this case the pattern is a dot, i.e. any character):

    .{1,3}
    

    Replace the dot with any regex. In your case ([ACR],)

    In other words: replace the + with {1,3}

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

Sidebar

Related Questions

I have searched around Google and StackOverflow trying to find a solution to this,
I've searched google and SO for a solution to this problem but have not
I have searched the web and have found no definitive solution, so here goes:
I have searched many a page of Google results as well as here on
I Have searched for a few hours on google and on here. I have
I have searched on google, followed scottguthrie's article & also here on SO for
I have searched all over google for a solution however this seems a new
I searched google and SO, but did not find a solution. I have an
I have searched online for a solution, but have yet to find one that
I have searched for hours now and haven't found a solution for my problem.

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.