partially cleaned code in regexec()