Title: Uncaught SyntaxError: invalid regular expression flag f
Last modified: February 7, 2022

---

# Uncaught SyntaxError: invalid regular expression flag f

 *  Resolved [wpnh](https://wordpress.org/support/users/wpnh/)
 * (@wpnh)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flag-f/)
 * Hello,
 * we are having a lot of sites, and at every website i´ve updated your plugin to
   the lastest version, i´m getting this error in the console:
 * Uncaught SyntaxError: invalid regular expression flag f
 * Can you help me out here? This comes only after activating Merge JS files…
 * Bye, Nico

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

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flag-f/#post-15337631)
 * OK, let’s start with some questions Nico:
    * where do you see the error, in the
   PHP errorlog or on the browser console? * what file & line number is identified
   together with the error? * from what version were you upgrading to 2.9.5.1?
 * frank
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flag-f/#post-15366193)
 * any news Nico?
 *  Thread Starter [wpnh](https://wordpress.org/support/users/wpnh/)
 * (@wpnh)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flag-f/#post-15368062)
 * Hi Frank,
    i´m seeing this in the browser console. Uncaught SyntaxError: invalid
   regular expression flag f
 * js/autoptimize_single_xxxxxxxx.js
 * after clicking the error message, this part i marked:
 * if(this.method===’GET’||this.method===’HEAD’){if(options.cache===’no-store’||
   options.cache===’no-cache’){var reParamSearch=/([?&])_=[^&]*/if(reParamSearch.
   test(this.url)){this.url=this.url.replace(reParamSearch,’$1_=’+new Date().getTime())}
   else{var reQueryString=/\?/this.url+=(reQueryString.test(this.url)?’&’:’?’)+’_
   =’+new Date().getTime()}}}}
 * —————
    LINE 107
 * Plugin Version from 2.7.8 (i guess) to Version 2.9.5.1
 * Thanks
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flag-f/#post-15368171)
 * OK, that JS is not Autoptimize’s, it’s merely being optimized by AO and based
   on the code snippet it *looks* like it’s WordPress core’s (blocks) `wp-includes/
   js/dist/wp-polyfill-fetch.js` which is loaded instead of `wp-includes/js/dist/
   wp-polyfill-fetch.min.js` because you’re likely having script debugging on. the
   best solution would be to disable script debugging, in which case AO will not
   mess with wp-polyfill-fetch as it will be minified already. alternatively you
   can untick the “minify excluded CSS/ JS” option.
 * hope this helps,
    frank
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flag-f/#post-15394916)
 * any news wpnh ?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flag-f/#post-15453720)
 * No feedback so I assume this got resolved? Feel free to follow up if you still
   encounter issues!
 * have a nice day!
    frank

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

The topic ‘Uncaught SyntaxError: invalid regular expression flag f’ 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/)

 * 6 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-invalid-regular-expression-flag-f/#post-15453720)
 * Status: resolved