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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:18:11+00:00 2026-05-31T19:18:11+00:00

Text : aaaa Pattern : aa then will two match: aa(0,1), aa(2,3) if I

  • 0

Text : “aaaa”

Pattern : “aa”

then will two match: aa(0,1), aa(2,3)

if I want three match : aa(0,1), aa(1,2), aa(2,3). (I believe this is a classical problem I don’t know how to describe this :'( )

How can I do it in java or python or others?

  • 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-31T19:18:13+00:00Added an answer on May 31, 2026 at 7:18 pm

    See this code here:

    String str = "aaaa";
    Pattern p1= Pattern.compile("(aa)");
    Matcher matcher = p.matcher(str);
    int start = -1;
    while(matcher.find(start + 1)) {
        start = matcher.start(0);
        System.out.println("Found: " + start);
    }
    

    It outputs:

    Found: 0
    Found: 1
    Found: 2
    

    This is basically how you manipulate from where to search the next match in java. Hopefully this will help you.

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

Sidebar

Related Questions

I have some text like $text=aaaa Last name:aaa city:aaaa email:ddd I want the output
text = I fixed bug #1234 and #7895 regex = /#(\d*)/ m = regex.match(text)
Situation: text: a string R: a regex that matches part of the string. This
#!/usr/bin/env python # -*- coding: utf-8 -*- import re text = aaaa[ab][cd][ef] a =
I have a div with text inside of it. I want the text to
The text string I want to validate consists of what I call segments. A
I have two views. The User view has some text and a button. I
I want to take in a certain format of one text file. After the
alt text http://img21.imageshack.us/img21/3262/snapshotosz.png I want to add a new tab or site in sharepoint
I want to have a multiline text nicely formatted and displayed in silverlight 4.0.

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.