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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:17:31+00:00 2026-05-27T16:17:31+00:00

I am new to Java. Can somebody help me? Is there any method available

  • 0

I am new to Java. Can somebody help me?

Is there any method available in Java which escapes the special characters in the below regex automatically?

Before escaping ***(.*) and after escaping \\*\\*\\*(.*)

I don’t want to escape (.*) here.

  • 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-27T16:17:31+00:00Added an answer on May 27, 2026 at 4:17 pm

    On the face of it, Pattern.quote appears to do the job.

    However, looking at the detail of your question, it appears that you want / expect to be able to escape some meta-characters and not others. Pattern.quote won’t do that if you apply it to a single string. Rather, it will quote each and every character. (For the record, it doesn’t use backslashes. It uses “\E” and “\Q”.\ which neatly avoids the cost of parsing the string to find characters that need escaping.)

    But the real problem is that you haven’t said how the quoter should decide which meta-characters to escape and which ones to leave intact. For instance, how does it know to escape the first three ‘‘ characters, but not the “.“?

    Without a clearer specification, your question is pretty much unanswerable. And even with a specification, there is little chance of finding an easy way to do this.

    IMO, a better approach would be to do the escaping before you assemble the pattern from its component parts … assuming that’s what is going on here.

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

Sidebar

Related Questions

I'm new to Java, and while reading documentation so far I can't find any
I am from Java backgroung and new to C++. There is a template which
How can I, in Java or using some other programming language, add a new
How come, in Java, I can write List<?> list = new LinkedList<Double>(); but not
Can somebody please help me understand why my custom JComponent 'Bar', only displays when
i'm new for java how can i add a button or others like Microsoft
I am very new to the whole J2EE architecture. Could somebody help me out?
Can somebody explain to me why classes are not first class objects in Java?
I'm new to Java and to OOP, so some things below may sound silly,
For a new Java web project I thought about using: Eclipse as IDE Mercurial

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.