[Solved] Python Regular Expression from File
This will return the elements you want: import re s=””‘journey (a,b) from station south chennai to station punjab chandigarh journey (c,d) from station jammu katra to city punjab chandigarh journey (e) from station journey (c,d) from station ANYSTRING jammu katra to ANYSTRING city punjab chandigarh ”’ matches_single = re.findall(‘journey (\([^,]+,[^,]+\)) from (\S+ \S+\s{0,1}\S*) to (\S+ … Read more