Python Detect Pattern In String Php