I would like to remove an unknown substring when it occurs between two known substrings (<foo> and </foo>). For example, I'd like to convert:
hello <foo>remove me</foo>
to:
hello <foo></foo>
I can do it with:
s = ...
s.replace(/<foo>.*?<\/foo>/, '<foo></foo>')
but I'd like to know if there's a way to do it without repeating the known substrings (<foo> and </foo>) in the regex and the replacement text.

