Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Your regexp is /{0}/gi/{0}/gi since you create it from a string. And it is not a valid expression. You need to escape { in the regexp because it has a special meaning in the regexp syntax, so it should be:

new RegExp('\\{'+i+'\\}', 'gi');

which is /\{0\}/gi/\\{0\\}/gi. You need to escape the escaping \\\ in the string.

Your regexp is /{0}/gi since you create it from a string. And it is not a valid expression. You need to escape { in the regexp because it has a special meaning in the regexp syntax, so it should be:

new RegExp('\\{'+i+'\\}', 'gi');

which is /\{0\}/gi. You need to escape the escaping \ in the string.

Your regexp is /{0}/gi since you create it from a string. And it is not a valid expression. You need to escape { in the regexp because it has a special meaning in the regexp syntax, so it should be:

new RegExp('\\{'+i+'\\}', 'gi');

which is /\\{0\\}/gi. You need to escape the escaping \\ in the string.

Source Link

Your regexp is /{0}/gi since you create it from a string. And it is not a valid expression. You need to escape { in the regexp because it has a special meaning in the regexp syntax, so it should be:

new RegExp('\\{'+i+'\\}', 'gi');

which is /\{0\}/gi. You need to escape the escaping \ in the string.

lang-js

AltStyle によって変換されたページ (->オリジナル) /