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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:17:18+00:00 2026-06-07T06:17:18+00:00

Hi guys i’m trying to retrieve the link between this two tag eg text

  • 0

Hi guys i’m trying to retrieve the link between this two tag eg text here it will then store it in a list, how do i retrieve those text with the pattern and matcher

public void getlinks() {
    Pattern Start = Pattern.compile(this.PatternStart);  //<Link>
    Pattern End = Pattern.compile(this.PatternEnd);      //</Link>
    Matcher mStart = Start.matcher(this.Source); // matches Start
    Matcher mEnd = End.matcher(this.Source); // matches end

   ????????????
}

Trying to find the link between and inside a html source, just using as an example

  • 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-07T06:17:19+00:00Added an answer on June 7, 2026 at 6:17 am

    In general you do like this:

    public static List<String> getLinks(String text) {
        Matcher matcher = Pattern.compile("<tagstart>(.*?)<tagend>").matcher(text);
        List<String> linkList = new ArrayList<String>();
        while (matcher.find()) {
            linkList.add(matcher.group(1));
        }
        return linkList;
    }
    

    where <tagstart> and <tagend> are your starting and ending tags. The matcher.group(1) gives you everything between the tags, where matcher.group() or matcher.group(0) would give you the tags too.
    Note that it is important to use the (.*?) if you have a text with multiple tag pairs, otherwise this will match the first <tagstart> and the last <tagend> and return everything in between.
    An example usage would be:

        System.out.println(getLinks("<tagstart>beer<tagend><tagstart>juice<tagend>"));
    

    which prints

    [beer, juice]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

guys. I have two view controllers with two uiwebviews. Here is my code: First
Guys, I'm trying to write xpath or css to find/click on list element All
Guys, this can't be for real I'm trying to make a .NET 2.0 executable
Guys, this probably will be fairly simple, but how am I able to find
Guys, I've came across this problem I can't resolve myselg, I'm pretty sure I
guys which text editor is good for Rubyonrails? i m using Windows and i
Guys this is driving me crazy.. I am amateur in the mod_rewrite topic.. I
Guys, I am using dynamic programming approach to solve a problem. Here is a
guys i have a xml file which is like this: <Point TestFlag=0 id=1 name=Conversation
guys, I'm trying to realize viewing comments on internet portal and I'm using UITableView.

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.