Saturday, October 3, 2015

The best regexp trick ever

It's true. It is! It's just this. Say I want to find all instances of X that aren't in quotes. Then I just say /"X"|(X)/ and ignore overall matches, just taking group 1 matches. Pretty brilliant, actually!

No comments:

Post a Comment