Nested Replacements
The problem is that the capture (
$1
) should be indented. Fortunately TextMate offers you its powerful format string syntax in the replacement field, which means we can perform further replacements on the capture.
Pretty cool, and I like the idea of previewing replacements.