Implements queryToRegExp method in StatementHelper object