Add test for subqueries
Fix in regex for subqueries