Today I was trying to use `fancybox` with `jQuery` and `bootstrap` while doing some website work. While trying to do some looping functions, like creating a gallery I started getting this error in the console:
Uncaught SyntaxError: Invalid regular expression: /(^|\.)fb(\.|$)/: Stack overflow
I did a lot of searching and found that error is typically caused by things like javascript variables that contain invisible characters like `\u200B` and maybe the `^M` windows line ending.
After searching through a lot of my files for the site I realized the problem was in one of the libraries I was using: Bootstrap
As far as I can tell there is an issue in Bootstrap version 2.3.0 that causes this. I switched from using this Bootstrap url (2.3.0):
netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js
To instead using 2.2.2 which is at:
netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js
The error went away and fancybox / fancyapps started working just fine again.
7 Responses to Uncaught SyntaxError: Invalid regular expression: /(^|\.)fb(\.|$)/: Stack overflow