$ matches at the end of a line, which is defined as the end of a line, or any location followed by a newline character.
However, the Windows newline flag contains two characters '\r\n', how do you '$'recognize '\r\n'as a newline character in bytes?
Here is what I have:
import re
input = b'''
//today is a good day \r\n
//this is Windows newline style \r\n
//unix line style \n
...other binary data...
'''
L = re.findall(rb'//.*?$', input, flags = re.DOTALL | re.MULTILINE)
for item in L : print(item)
now output:
b'
b'
b'
but the expected result is as follows:
the expected output:
b'
b'
b'
source
share