Merge pull request #2192 from maryamtahhan/bugfix_regex_memleak