handle escape characters in regular expressions and C