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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:37:14+00:00 2026-05-18T08:37:14+00:00

Regex Pattern – ([^=](\\s*[\\w-.]*)*$) Test String – paginationInput.entriesPerPage=5 Java Regex Engine Crashing / Taking

  • 0

Regex Pattern – ([^=](\\s*[\\w-.]*)*$)

Test String – paginationInput.entriesPerPage=5

Java Regex Engine Crashing / Taking Ages (> 2mins) finding a match. This is not the case for the following test inputs:

paginationInput=5

paginationInput.entries=5

My requirement is to get hold of the String on the right-hand side of = and replace it with something. The above pattern is doing it fine except for the input mentioned above.

I want to understand why the error and how can I optimize the Regex for my requirement so as to avoid other peculiar cases.

  • 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-18T08:37:14+00:00Added an answer on May 18, 2026 at 8:37 am

    You can use a look behind to make sure your string starts at the character after the =:

    (?<=\\=)([\\s\\w\\-.]*)$
    

    As for why it is crashing, it’s the second * around the group. I’m not sure why you need that, since that sounds like you are asking for :

    • A single character, anything but equals
    • Then 0 or more repeats of the following group:
      • Any amount of white space
      • Then any amount of word characters, dash, or dot
    • End of string

    Anyway, take out that *, and it doesn’t spin forever anymore, but I’d still go for the more specific regex using the look behind.

    Also, I don’t know how you are using this, but why did you have the $ in there? Then you can only match the last one in the string (if you have more than one). It seems like you’d be better off with a look-ahead to the new line or the end: (?=\\n|$)

    [Edit]: Update per comment below.

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

Sidebar

Related Questions

What regex pattern would need I to pass to java.lang.String.split() to split a String
I've created the following regex pattern in an attempt to match a string 6
I'm using java.util.regex.Pattern to match passwords that meet the following criteria: At least 7
Is there a regex pattern that will match a string that contains repeated pattern,
I am looking for a regex pattern that will match a string. A string,
Hi I'm wanting a Regex pattern to match a very specific string syntax. Below
import java.util.regex.Pattern; class HowEasy { public boolean matches(String regex) { System.out.println(Pattern.matches(regex, abcABC )); return
I want to write the regex pattern which should match the string in between
I am looking for a regex pattern that would match several different combinations of
could someone help me with the regex pattern that i could use to match

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.