Don't match whitespace inside capture

The whitespace surrounding a match should not be matched so it doesn't get an incorrect scope. Also correct the numbering of the captures.