Javascript RegExp methods toLocaleString()
and toString()
return the literal representation of the regular expression, regardless of how it was created.
Consider this example:
let pattern = new RegExp("\\[bc\\]at", "gi"); console.log(pattern.toString()); // /\[bc\]at/gi console.log(pattern.toLocaleString()); // /\[bc\]at/gi