use regex instead of indexof with search