fix regex so it includes last char of query string; make case insensitive