RegEx for: {0}

I feel like an idiot to ask this, but which regex should match a literal string: {0}

This will be used in JavaScript with the string object replace function. I've tried several things and nothing seems to work.

Thanks,
Frank

0


a source to share


2 answers


"{0}".match(/\{0\}/)

      



+11


a source


Thank you bdonlan.

Your post told me that this is not my regEx, but my use of the replace function.

I have tried:

MyString.replace(/\{0\}/, "test");

      



And it should have been:

 MyString = MyString.replace(/\{0\}/, "test");

      

Thanks again!

+1


a source







All Articles