Refactor record command to use POSIX regexes.