vesln/nixt — pull request #4 by tivac (2014-01-14 07:15:34+00:00)
Title: Update regexes so that it doesn't strip first \n

I started trying to use nixt on a project and while I love the API, it was weirdly stripping the very first `\n` in my stdout/stderr strings. I did some digging around and I'm pretty sure I tracked down why.

It has to do with operator precedence inside regexes, [here's an example](http://regexpal.com/?flags=g®ex=a%3Fb|b%24&input=fooga%20ab%20wooga%20booga%20b) of what is happening. You can fix it in a couple of ways, either by using a [non-capturing group](http://regexpal.com/?flags=g®ex=%28%3F%3Aa%3Fb|b%29%24&input=fooga%20ab%20wooga%20booga%20b) or just by dropping the `OR` entirely since I don't think a `\r` by itself should be appearing anywhere. I chose to drop the `OR` entirely, but it'd be trivial to add back in & use a group instead.

For my own sanity I fleshed out the newline tests a bit by adding `\r\n` tests & a fixture as well, just to make sure I wasn't regressing anything.