[TxMt] How to insert a letter/sign at the end of matching lines?

Marius Hofert m_hofert at web.de
Wed Apr 6 13:26:38 UTC 2011


Dear textmate experts,

I have a text file with lines like this:

dog={brown, bark},
cat={white, purr},
mouse={gray, beep},

I would like to end up with this:

dog={brown, bark},
cat={{white, purr}},
mouse={gray, beep},

Replacing "cat={" by "cat={{" is trivial, but how can I replace the closing brace "}" by "}}" for that lines? I tried to work with regular expressions and ^.*cat={.*$ matches the lines starting with "cat={", but I couldn't manage to tell textmate's "Find" to basically add something to a line. I also seems to me that although the "Find"-box in textmate's "Find" can deal with regular expressions, the "Replace"-box ignores regular expressions. 

I know textmates "Edit Each Line in Selection", but I can't select all lines starting with "cat={" by hand, there are simply too many in my file. 

Cheers,

Marius 


More information about the textmate mailing list