2013-07-31

regex

I needed a regex to append \index{foo} to any occurrence of **foo** so i wrote
's/\*\*\([^*]*\)\*\*/\*\*\1\*\*\\index{\1}/g'
and it worked the very first time! Yes I feel nerdy today :-) :-)