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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:03:52+00:00 2026-06-13T01:03:52+00:00

I have String content= <a data-hovercard=\/ajax/hovercard/group.php?id=180552688740185\> <a data-hovercard=\/ajax/hovercard/group.php?id=21392174\> I want to get all the

  • 0

I have

String content= "<a data-hovercard=\"/ajax/hovercard/group.php?id=180552688740185\">
                 <a data-hovercard=\"/ajax/hovercard/group.php?id=21392174\">"

I want to get all the id between "group.php?id=" and "\""

Ex:180552688740185

Here is my code:

String content1 = "";
Pattern script1 = Pattern.compile("group.php?id=.*?\"");
Matcher mscript1 = script1.matcher(content);
while (mscript1.find()) {
    content1 += mscript1.group() + "\n";
}

But for some reason it does not work.

Can you give me some advice?

  • 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-13T01:03:54+00:00Added an answer on June 13, 2026 at 1:03 am

    Why are you using .*? to match the id. .*? will match every character. You just need to check for digits. So, just use \\d.

    Also, you need to capture the id and then print it.

    // To consider special characters as literals
    String str = Pattern.quote("group.php?id=") + "(\\d*)";
    
    Pattern script1 = Pattern.compile(str);
    // Your matcher line
    while (mscript1.find()) {
        content += mscript1.group(1) + "\n";   // Capture group 1 contains your id
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a content string that starts with an unordered list I want to
I have a String with this content: href=http://www.website.com/ /> [...] [...] I just want
I have to get a part of my content provider query in a String[]
Say I have a Java String which has xml data like so: String content
I have following script: jQuery('#content-page-<?php echo $post->ID ?>') .data('content','<div class=page-content><?php echo $post->post_content; ?>'); In
I have a string which has the below content String msg = The variables
I have an example json as below: { Passwd:String content, Userme:String content } how
I have the following class: private class NodeTemp { public string Content; public NodeTemp
I have a string of HTML contained in a var called content. The string
I have a string which holds a small amount of HTML generated content. I

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.