I am trying to extract some string from a binary file. When I use this regular expression with strings in linux it works fine but it does not work in python.
In strings:
strings -n 3 mke2fs | grep -E '^([0-9][0-9]*(\.[0-9]+)+)'
the result: 1.41.11
In python:
import re
f = open("mke2fs","rb").read()
for c in re.finditer('^([0-9][0-9]*(\.[0-9]+)+)',f):
print c.group(1)
The result is empty. How can I resolve this? Is it because of my Python version (I'm using Python 2.7)? I tried using regex (another re alternative) still with no result.