Title: Uncaught SyntaxError: Invalid regular expression flags
Last modified: May 17, 2018

---

# Uncaught SyntaxError: Invalid regular expression flags

 *  Resolved [wandererkh](https://wordpress.org/support/users/wandererkh/)
 * (@wandererkh)
 * [8 years ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flags/)
 * Hi,
 * Have got `try{/s/loaded/e40fd7c51503.js}catch(e){console.log(e)}` code that causes
   syntax error and stops execution of other scripts
    All options in Minify JavaScript
   section are on /s/loaded/e40fd7c51503.js – is one of Ninja’s merged and minified
   script Version: 0.9.25
 * Please fix this issue and thanks in advance

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

 *  Plugin Author [Denis Ryabov](https://wordpress.org/support/users/dryabov/)
 * (@dryabov)
 * [8 years ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flags/#post-10296676)
 * Which of “HTML Parser” options do you use (see Advanced tab of the settings page)?
   Does changing of it affect the error?
 * Did you install 0.9.25 or update previous version (in the last case, which one
   was installed initially)?
 * PS. As a workaround, most likely it should be sufficient to disable “Load external
   scripts” option in the “Leverage browser caching” section, and clear cache in
   the “Troubleshooting” section.
 *  Thread Starter [wandererkh](https://wordpress.org/support/users/wandererkh/)
 * (@wandererkh)
 * [8 years ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flags/#post-10297031)
 * Fast simple HTML parser was used, switching to Standard didn’t change anything
 * Updated from 0.9.23
 * Problem has disappeared so silent as it has appeared, but thank you for the instructions–
   they may be needed in the future
 *  Thread Starter [wandererkh](https://wordpress.org/support/users/wandererkh/)
 * (@wandererkh)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flags/#post-10314041)
 * Hi Denis,
    Have got same error again and your PS has helped, thanks. Is there
   way to filter Ninja’s scripts in future releases?
 *  Plugin Author [Denis Ryabov](https://wordpress.org/support/users/dryabov/)
 * (@dryabov)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flags/#post-10314659)
 * What is URL of your website? I’ll try to reproduce the issue locally and fix 
   it in the next release.

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

The topic ‘Uncaught SyntaxError: Invalid regular expression flags’ is closed to 
new replies.

 * ![](https://ps.w.org/psn-pagespeed-ninja/assets/icon.svg?rev=1722219)
 * [PageSpeed Ninja - Cache, Minify, Defer CSS JavaScript, Critical CSS, Optimize Images, Convert WebP](https://wordpress.org/plugins/psn-pagespeed-ninja/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/psn-pagespeed-ninja/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/psn-pagespeed-ninja/)
 * [Active Topics](https://wordpress.org/support/plugin/psn-pagespeed-ninja/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/psn-pagespeed-ninja/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/psn-pagespeed-ninja/reviews/)

## Tags

 * [js](https://wordpress.org/support/topic-tag/js/)
 * [syntaxerror](https://wordpress.org/support/topic-tag/syntaxerror/)

 * 4 replies
 * 2 participants
 * Last reply from: [Denis Ryabov](https://wordpress.org/support/users/dryabov/)
 * Last activity: [7 years, 12 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flags/#post-10314659)
 * Status: resolved