[Solved] Regular Expression to find specific section of a text file
regex = re.compile(“.*(HEADER.*$.*A:86::ABC)”, re.MULTILINE|re.DOTALL) >>> regex.findall(string) [u’HEADER:KHJ3\nThis is section text under header \nA match text will look like this A:86::ABC’] Hopefully this helps. For 2 captures use “.*(HEADER.*$)(.*A:86::ABC)” 1 solved Regular Expression to find specific section of a text file