0

I'm trying to figure out a way to locate multi-line strings embedded in a binary file. The code I've got will identify non-multi-line versions of the pattern, but not the multi-line versions.

I've tried this with with re.findall():

import re
a = open('file', 'rb')
b = a.read()
c = re.findall(b'[<]{2}.*?[>]{2}', b, re.MULTILINE)

And with re.search():

import re
a = open('file', 'rb')
b = a.read()
c = re.search(b'[<]{2}.*?[>]{2}', b, re.MULTILINE)
c.group()

In each case, the code will return non-multi-line substrings, but not those where a \n character appears in the string.

Any ideas?

nxl4
  • 714
  • 2
  • 8
  • 17

0 Answers0