Implement more efficient algorithm that skips over comments and quotes.

Allow onMatch callbacks to return a new index position.
Fix tests.