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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:14:50+00:00 2026-05-23T14:14:50+00:00

I am in the process of migrating from Jakarta Regexp to the standard Java

  • 0

I am in the process of migrating from Jakarta Regexp to the standard Java 6 regular expressions package java.util.regex. I noticed the following difference when not specifying the beginning ^ and end $ in a regexp: Jakarta Regexp returns true when the regexp matches part of the string, while the Java 6 java.util.regex package does not:

String regexp = "\\d";
String value = "abc1abc";

Pattern pattern = Pattern.compile(regexp);
Matcher matcher = pattern.matcher(value);
result = matcher.matches(); // returns false

Returns false whereas:

RE re = new RE(regexp);
re.match(value); // returns true

Returns true.

What is the reason behind this? I’ve thought about greedy/lazy matching but that doesn’t seem to be relevant in the case of JDK 6 not matching.

Are there any other differences that I should be aware of?

  • 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-23T14:14:50+00:00Added an answer on May 23, 2026 at 2:14 pm

    The java.util.regex.Matcher.matches() method will try to match the complete input string against your regular expression which will be false.

    If you want to search for the pattern in the input string, you’ll need to use java.util.regex.Matcher.find() method instead:

     result = matcher.find(); // returns true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am in the process of migrating from a Django FastCgi setup in Apache
We are in the process of migrating our bug tracking to Bugzilla from a
THE TASK: I am in the process of migrating a DB from MS Access
I am in the process of migrating an application ( Sage ) from Twisted
We are currently in the process of migrating our application from our production environment
We're in process of migrating one stable project from Castle Windsor 2.5.2 to 3.0.
I'm in the process of migrating a rather extensive REST service from WCF to
We are in the process of migrating an app to .NET 4.0 (from 3.5).
We are currently in the process of migrating from an aged proprietary directory service
I am trying to define a process for migrating django projects from my development

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.