fixed typo, changed escape fn to use regex