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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:38:24+00:00 2026-06-12T23:38:24+00:00

WHAT I DO: Make sure Firebug is working. Put a break point in the

  • 0

WHAT I DO:

  • Make sure Firebug is working.
  • Put a break point in the isWrappedInParens() function.
  • Navigate to my webapp.
  • Trigger a call to isWrappedInParens().
  • Step through isWrappedInParens(). Everything goes fine, but it does not proceed past the line of code indicated as the “CRASH POINT”.
  • I also tried it without Firebug running or having a break point, but it still freezes.

WHAT I NOTICE:

  • In most cases, isWrappedInParens() works fine.
  • When it does not work, Firefox freezes. I can still minimize/expand/close the window, though.
  • I also noticed that when the test string is a bit shorter (less parentheses), firefox hangs but eventually finishes (~30 seconds) correctly.

EXAMPLE STRING THAT CRASHES FIREFOX

// Note that this is not wrapped in parentheses,
// since it is two separate sets of nested parentheses
var test = "(the OR (and) OR (and) OR (and)) AND ((to) OR (to) OR (to))";

BACKGROUND

  • Browser: Firefox 3.6.18
  • The webapp is a jetty application.

CODE

isWrappedInParens = function(str){
    if(_.isNull(str)) {
        return false;
    }
    str = str.trim();

    var pattern = /^[(](([(][^()]+[)]|[^()]+)|[(]([(][^()]+[)]|[^()]+)+[)])+[)]$/;

    var matchesPattern;
    try{
        matchesPattern = str.match(pattern) || null; //CRASH POINT!!!!!!!!!!!
    }catch(err){
        return false; //Note that no error is ever caught from freezing
    }

    var isWrapped = !_.isUndefined(matchesPattern) && !_.isNull(matchesPattern);
    return isWrapped;
}

WHERE THE REGEX CAME FROM:

// Atoms, building blocks for the expressions
var parenAtom = "[(][^()]+[)]";
var nonParenAtom = "[^()]+";

// Expressions, building blocks for the final regular expression
var baseCase = "(" + parenAtom + "|" + nonParenAtom + ")";
var nestedCase = "[(]_base_[)]"
    .replace("_base_", baseCase);

// Regular Expression
var wholeCase = "^[(](_base_|_nested_)+[)]$"
    .replace("_base_", baseCase)
    .replace("_nested_", nestedCase);
var pattern = new RegExp(wholeCase, "");
  • 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-12T23:38:25+00:00Added an answer on June 12, 2026 at 11:38 pm

    From my comment:

    Looking through the Firefox bug database, there have been many regular expression bugs found and categorized loosely as “exponential behavior” bugs. Most of them have been fixed in the newer versions of the browser.

    In this bug there are a couple of comments from Brendan Eich about the issue, and he lists several other bugs (some pretty old). Another comment there alludes to an “overhaul in regular expression” in Firefox 4, suggesting that many changes occurred as far back as that.

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

Sidebar

Related Questions

SOLUTION Make sure in the plist that the storyboard name is listed as the
Solution: Make sure nothing is null! I have a ListView throwing a NullPointerException, and
Edit Make sure you don't juxtapose the request and response objects. things will be
I would like to make sure my classes are robust - even if they
Is there away to make sure that all digits inside a INPUT#barcode start with
I want to make sure a CGSize is smaller or equal to another CGSize
Just want to make sure one thing. In a windows machine (either a desktop
Just to make sure I'm understanding shallow copies of reference types correctly and that
I want to make sure a string has only characters in this range [a-z]
How can I make sure in the following code snippet that IDataReader is disposed

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.