string.match causes engine to hang with specific string and RegEx expression
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: official.xenrix, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0
Steps to reproduce:
I ran this in the Firefox browser dev console, but it should apply anywhere.
Create a new variable with the contents of this Pastebin -> https://pastebin.com/raw/5RzydPW8
Run the following (replacing myString
with your variable name): console.log(myString.match(/\]\(*(.*?)*\)/))
Actual results:
Firefox notified of a webpage slowing down the browser about 10s after executing this code.
Expected results:
The browser console should have returned an array of matched items, as shown on the Regexr website for the exact same string and RegEx expression
Updated•4 years ago
|
Comment 2•4 years ago
|
||
Note: /\]\((.*?)\)/
should accomplish what it looks like you're trying to do without exponential blowup.
Description
•