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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 534k
  • Answers 534k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Put a DisplayFormatAttribute.DataFormatString attribute on the property: [DisplayFormat(ApplyFormatInEditMode=true, DataFormatString =… May 17, 2026 at 12:51 am
  • Editorial Team
    Editorial Team added an answer Nick, surprisingly, it's quite difficult to find information on advanced… May 17, 2026 at 12:51 am
  • Editorial Team
    Editorial Team added an answer I think you'll have to rename it. 'class' is a… May 17, 2026 at 12:51 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have an implementation that just like gmail application, but have met some problem
I am testing some weird-looking CSS code that I wrote (I'm using a mix
comrades) I've found some interesting behavior of Invalidate method in multithreaded applications. I hope
I have created a rather complicated piece of (Java) code for a game I
I found this while searching for how to fake multiple inheritance in PHP (since
I've got a trait that looks like this (some further information can be found
I am having some trouble running this linked list implementation (containing words as data).
After executing some new code, my C++ application started to behave strange (incorrect or
I'm using the EmailMultiAlternatives class to send text and html mails with django. While
I'm testing an android application with a long running service. I'm using Eclipse and

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.