I want to match on the contents of some code between the strings var and );
I'm currently using:
var([^)]+)\);
And this matches, except for when another closing bracket appears elsewhere in the text. So,
var (this does match);
var (this) doesn't match but should);
Regex example here