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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:55:04+00:00 2026-05-27T22:55:04+00:00

Very simply, idParser as seen below is not finding the number in my passedUrl

  • 0

Very simply, idParser as seen below is not finding the number in my passedUrl string.
Here is the LogCat out for the Lod.d’s:

01-05 11:27:48.532: D/WEBVIEW_REGEX(29447): Parsing: http://mymobisite.com/cat.php?id=33
01-05 11:27:48.532: D/WEBVIEW_REGEX(29447): idParse: No Matches Found.

annnnd heres the block of trouble.

Log.d("WEBVIEW_REGEX", "Parsing: "+passableUrl.toString());
Matcher idParser = Pattern.compile("[0-9]{5}|[0-9]{4}|[0-9]{3}|[0-9]{2}|[0-9]{1}").matcher(passableUrl);
if(idParser.groupCount() > 0)
    Log.d("WEBVIEW_REGEX", "idParse: " + idParser.group());
else Log.d("WEBVIEW_REGEX", "idParse: No Matches Found.");

note, this is me getting a bit sloppy now, I’ve tried a bunch of different syntaxes (all verified working at http://www.regextester.com/index2.html on all three modes ) and I’ve even looked up the documentation ( http://docs.oracle.com/javase/tutorial/essential/regex/char_classes.html). This is starting to get on my final nerve.
using

.find()

instead of group() stuff just yields “false” … Can someone help me to understand why i cant get this regular expression to work?

Cheers!

  • 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-27T22:55:04+00:00Added an answer on May 27, 2026 at 10:55 pm

    The problem is that groupCount() doesn’t do what you think it does. You should instead use idParser.find(). Like this:

    if(idParser.find())
        Log.d("WEBVIEW_REGEX", "idParse: " + idParser.group());
    else Log.d("WEBVIEW_REGEX", "idParse: No Matches Found.");
    

    You could also simplify the pattern a bit, using \d{1,5} instead:

    Matcher idParser = Pattern.compile("\\d{1,5}").matcher(passableUrl);
    

    Full example:

    String passableUrl = "http://mymobisite.com/cat.php?id=33";
    Matcher idParser = Pattern.compile("\\d{1,5}").matcher(passableUrl);
    if (idParser.find())
        System.out.println("idParse: " + idParser.group());
    else 
        System.out.println("idParse: No Matches Found.");
    

    Outputs:

    idParse: 33
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very simply in SQL Server T-SQL parlance, how do you conver the number 9
I'm likely doing something very simply wrong, but I'm not quite sure what it
Very simply, how does one get the second round below? hello 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 (first round
I have a very simply subclass of UIButton that will fire off a custom
I have a very simply query like this: SELECT users.id, COUNT(others.id) as c FROM
Ok, I'm very simply trying to take this example... http://jsfiddle.net/shanabus/HGF59/ and put it on
I am trying to create a very simple chat window that simply has the
Very simple example: #include <string> #include <boost/program_options.hpp> namespace po = boost::program_options; int main(int argc,
Very simply I am looking to get a list of all devices on a
Very simply, I want to be able to access the year from the select

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.