Regex in e-texteditor

Today I was faced with the task of converting my existing stylesheet to sass. But my stylesheet is so big! I really didn't want to do this by hand. Now, I had heard somewhere, and half suspected you could use search and replace with regex in e-texteditor(the textmate equivalent on windows). Wow! was I blown away and cursed myself for not knowing to use this earlier. So what I ended up doing was a version of this:

  1. replace ([^ ]+)\: with :$1 to change font-size: to :font-size
  2. replace [^ ]*{[^ ]*\n with \n to remove all open braces
  3. replace }[^ ]*\n with \n to remove all closing braces

This feature really made my day.

Now sass and haml, I think they are still a bit buggy: they don't handle bad input very well. But I hope that it improves.

blog comments powered by Disqus