Uncaught SyntaxError: Invalid regular expression: /(^|\.)fb(\.|$)/: Stack overflow

Uncaught SyntaxError: Invalid regular expression: /(^|.)fb(.|$)/: Stack overflowToday 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):


To instead using 2.2.2 which is at:


The error went away and fancybox / fancyapps started working just fine again.

Related Posts:

  • No Related Posts
This entry was posted in Tech Tips. Bookmark the permalink.

7 Responses to Uncaught SyntaxError: Invalid regular expression: /(^|\.)fb(\.|$)/: Stack overflow

  1. Artem says:

    Thank you very much! I’ve blown up my brain, searching for the reason of this error.

  2. Bhavin says:

    Thanks, this helped me a lot. Otherwise , I would have wasted hours on this.

  3. Klaas says:


    I ran into this problem to. As Weydson says, it seems fixed in 2.3.1.

  4. Weydson says:

    Thank you, I was having the same problem. Bootstrap 2.3.1 seems to have fixed this issue though.

  5. Canser says:

    Thank you!

  6. Andrea says:

    Luv you! thank you very much.

  7. Matt says:

    Thank you very much for this. I normally do not leave comments, but I have been scratching my head and frustrated for the last hour…

    It was bootstrap. I back-tracked versions and everything was good again.


Leave a Reply

Your email address will not be published. Required fields are marked *