Extract query string