views:

108

answers:

2

I feel like an idiot for asking this but what would a regular expression be to match the literal string: {0}

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

Thanks,
Frank

+10  A: 
"{0}".match(/\{0\}/)
bdonlan
+1  A: 

Thank you bdonlan.

Your post informed me that it wasn't my regEx but my use of the replace function.

I was trying:

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

And it should have been:

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

Again, thank you!

Frank V