viernes, 14 de octubre de 2011

I still think Perl

The other day, a friend asked how to split a string by commas, but only if they aren't inside a tag, say enclosed by '<' and '>'. I tried python, but somehow regexes are so hardwired in my head, that I can't work with languages that do not have regexen so hardwired in their heart.

Here it is. Tiny, but gets the job done. And that's what perl is for. a regex with lookbehind stuffed into split. No problem sir!