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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:36:48+00:00 2026-05-14T18:36:48+00:00

I found some problem while testing my NLP system. I have a java regex

  • 0

I found some problem while testing my NLP system. I have a java regex "(.*\\.\\s*)*Dendryt.*" and for string "v Table of Contents List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " it just dont stop computing.

Its clear that this regex complexity is very high, I will try to refactor it. Have you some suggestions for me for a future regex development ???

Thanks.

  • 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-14T18:36:49+00:00Added an answer on May 14, 2026 at 6:36 pm

    You’re running into catastrophic backtracking by repeating a group containing repeated quantifiers. The combinatorial explosion that follows will then (given enough input) lead to a (tada!) Stack Overflow.

    Simplified, your regex tries to

    (.*\.\s*) match any succession of characters including dots and spaces, followed by a dot, followed by zero or more spaces, then

    (...)* repeat this any number of times.

    Dendryt Only then it tries to match “Dendryt”.

    Since this fails, the engine backtracks, trying a different permutation. The possibilities are nearly endless…

    To illustrate, here’s a screenshot of RegexBuddy’s regex debugger on a simplified version of your data:

    RegexBuddy Screen Shot http://img714.imageshack.us/img714/3275/screen017.png

    The engine gives up after 1 million permutations.

    Your regex would be a little better like this (don’t forget to escape the backslashes when converting it to a Java string):

    (.*)(\.\s*)*+Dendryt
    

    In this case the *+, a so-called possessive quantifier, will refuse to backtrack once it has matched. That way, the regex engine can fail much faster, but it’s still bad because (.*) matches anything, even the dots.

    ([^.]*)(\.\s*)*+Dendryt
    

    is safe, unless your data can contain dots before the “dotted line bit”. All in all, please state your requirements a bit more clearly, then a better regex can be built.

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

Sidebar

Related Questions

Although I have found some solutions to this problem, none of them refer to
I have some problem with displaying emoji icon in Android TextView First, I found
I found the following lines in a makefile tutorial, but I have some problem
I have tried to find some articles on my problem, but haven't found anything
While creating my testing framework I've found a strange problem. I want to create
I found some problem. When i running apc_store and more times update a page
I got problem with sending data in Android using httpPost. I found some example,
Already found this page with some helpful hints. Problem is I need to debug
I've search for some solution to my problem and I found this link .
I have an implementation that just like gmail application, but have met some problem

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.