Generation of python script with regex search option