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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:27:07+00:00 2026-06-14T17:27:07+00:00

I am new to regular expressions. I thought that this would return matched succesfully

  • 0

I am new to regular expressions. I thought that this would return matched succesfully, but it does not. Why is that so?

String myString = "SUB_HEADER5_LABEL";
if (myString.matches(Pattern.quote("SUB_HEADER?_LABEL")))
{
    System.out.println("matched succesfully");
}
  • 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-14T17:27:09+00:00Added an answer on June 14, 2026 at 5:27 pm

    Pattern.qoute() will create a Pattern that only matches exactly the given String. you need

    if (myString.matches("SUB_HEADER\\d_LABEL"))
    

    If you expect the number to exceed 9, add the + quantifier like

    if (myString.matches("SUB_HEADER\\d+_LABEL"))
    

    if you want to match a digit where you have ? (wich means one or zero R in your case, because it’s a quantifier). you need to replace it with [0-9] or \\d.

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

Sidebar

Related Questions

I'm new to regular expressions and i'm feeling this very difficult to solve: I
I'm not new to using regular expressions, and I understand the basic theory they're
am new to regular expressions and i cant handle a regex search using grep..
im new to regular expressions in php. I have some data in which some
I'm new to regular expressions, and have no clue where to start, it's like
I'm completely new to regular expressions, and I need to filter all the words
I am completely new to regular expressions so I'm looking for a bit of
So I'm new to regular expressions and having difficulty understanding them. To get my
Bear with me, as I'm quite new to using regular expressions. I have regexp
I'm not sure how to accomplish this with a regular expression (or if 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.