Bash Regex Escape Function Python