Title: SyntaxError: Invalid regular expression — stack overflow
Last modified: January 12, 2017

---

# SyntaxError: Invalid regular expression — stack overflow

 *  Resolved [inspired888](https://wordpress.org/support/users/inspired888/)
 * (@inspired888)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/syntaxerror-invalid-regular-expression-stack-overflow/)
 * Hi Frank,
    I’ve got an issue I’ve not been able to solve. Odd thing is, it was
   not occurring previously. I was getting a JQuery issue, so I added JQuery.js 
   back into the JS Exclusions, along with a few others. Full exclusions are:
 * But somewhere along the way, I started getting these errors:
 *     ```
       Uncaught SyntaxError: Invalid regular expression: /(^|\.)cfs1(\.|$)/: Stack overflow
           at RegExp.exec (<anonymous>)
           at RegExp.test (native)
           at Object.remove (https://cdn.couragemyloveclothing.com/wp-content/cache/autoptimize/js/autoptimize_a897aaf4351095e5983cc2c9a6daf9c8.js:12:35273)
           at Object.remove (https://cdn.couragemyloveclothing.com/wp-content/cache/autoptimize/js/autoptimize_a897aaf4351095e5983cc2c9a6daf9c8.js:12:35541)
           at Object.remove (https://cdn.couragemyloveclothing.com/wp-content/cache/autoptimize/js/autoptimize_a897aaf4351095e5983cc2c9a6daf9c8.js:12:35541)
        ... (etc. above repeats many times)
       remove @ autoptimize_a897aaf….js:12
       ... (etc)
       ```
   
 *     ```
       autoptimize_a897aaf….js:12 Uncaught SyntaxError: Invalid regular expression: /(^|\.)cfs1(\.|$)/: Stack overflow
           at RegExp.exec (<anonymous>)
           at RegExp.test (native)
           at Object.remove (https://cdn.couragemyloveclothing.com/wp-content/cache/autoptimize/js/autoptimize_a897aaf4351095e5983cc2c9a6daf9c8.js:12:35273)
           at Object.remove (https://cdn.couragemyloveclothing.com/wp-content/cache/autoptimize/js/autoptimize_a897aaf4351095e5983cc2c9a6daf9c8.js:12:35541)
           at Object.remove (https://cdn.couragemyloveclothing.com/wp-content/cache/autoptimize/js/autoptimize_a897aaf4351095e5983cc2c9a6daf9c8.js:12:35541)
           ... (etc.)
       ```
   
 * I’ve tried clearing Cache, and Autoptimize, but error continues. Looking in the
   Autoptimize JS file that’s referred to, I was unable to retermine what original
   JS file is causing the issue, for exclusion.
 * Any help would be greatly appreciated.
 * Thanks,
 * Jonathan

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [inspired888](https://wordpress.org/support/users/inspired888/)
 * (@inspired888)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/syntaxerror-invalid-regular-expression-stack-overflow/#post-8648553)
 * Whoops. Forgot to paste in current JS exclusion list:
    `seal.js, jquery.js, jquery-
   migrate.js, jquery-migrate.min.js, jquery.themepunch.tools.min.js, jquery.themepunch.
   tools.js`
 * Not sure all those are needed any more, because activating `Add try-catch wrapping?`
   seemed to fix the errors more (or perhaps all) of those JS files were causing.
 *  Thread Starter [inspired888](https://wordpress.org/support/users/inspired888/)
 * (@inspired888)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/syntaxerror-invalid-regular-expression-stack-overflow/#post-8648716)
 * UPDATE: Looks like I found the cause. It was the `A3 Lazy Load` plug-in causing
   the issue. As that plug-in isn’t having the desired effect anyway, I have removed
   it. Problem solved.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/syntaxerror-invalid-regular-expression-stack-overflow/#post-8649641)
 * great work, thanks for communicating the solution here!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘SyntaxError: Invalid regular expression — stack overflow’ is closed to
new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/syntaxerror-invalid-regular-expression-stack-overflow/#post-8649641)
 * Status: resolved