[Solved] Find a part of a string using python? [closed]
x=re.search(‘(?<=abc).*(?=ghi)’,’abcdefghi’).group(0) print(x) output def Explanation Regex (?<=abc) #Positive look behind. Start match after abc .* #Collect everything that matches the look behind and look ahead conditions (?=ghi) #Positive look ahead. Match only chars that come before ghi re.search documentation here. A Match Object is returned by re.search. A group(0) call on it would return the … Read more