bug fix 2 for the regex functionality