correcting XSS vulnerability in search pattern