javascript inspection shows "pattern expected" for valid regular expression

I am working in javascript, using IntelliJ IDEA 2016.3.2.  The code is like this:

  '{{count}} widgets are available'.replace(/{{count}}/g, widgetsAvailable);

The "c" and "}}" characters both have red underlines in the IDE and the message "Pattern expected" pops up on rollover.  The replace() works fine, however, in the browsers I have tested with.  I took a quick glance around the net and it seems that for "basic" grep the braces need escaping, but in "extended" grep they are treated as literals.  Maybe this inspection is wrong?  Or is it possible that there are "basic" greps in some JS implementations?

Right or wrong, I was unable to find the inspection in the prefs, to turn it off there.  Is it in that "switchable" inspection list and I missed it?


Please sign in to leave a comment.