findNodesByExample with regex throwing error

We are using findnodesbyexample method in gojs treeview to get node list by text.

In findnodesbyexample, we have to pass regex format object,
var regex = new RegExp(value, “i”);
but regex throws error “Uncaught SyntaxError: Invalid regular expression” for special characters like “(”,

So is there any solution or alternative way for same?

That’s a bug in our sample. Use the escapeRegExp function defined at Regular expressions - JavaScript | MDN

We applied given solution it’s working fine. Thank you for your response.