Perl regex didn't work through subprocess.call, don't feel like debugging so replaced it with python code.