I'm trying to extract the String Hex-STRING until the end of line. But what it matches is Hex-STRING: 84 16 F9 B0 05 1F 70 4F 57 4C A8 1F 60 E3 27 A1
E0 CD C4 E9 84 C3 68 53 C4 E9 84 C9 7A BB C4 E9 84 AC
.
Something is missing in this expression? I already tried to include $
but it does not work.
RegEX: Hex-STRING:\s(.+)
Test String:
iso.3.6.1.4.1.25355.3.2.6.4.2.5.1.7.4.2.13.36 = Hex-STRING: 84 16 F9 B0 05 1F 70 4F 57 4C A8 1F 60 E3 27 A1
E0 CD C4 E9 84 C3 68 53 C4 E9 84 C9 7A BB C4 E9 84 AC
C3 68 53 27 CC 58 97 84 AC 74 F7 60 E3 27 CC 58 97
84 AC 74 F7 60 E3 27 CC 58 97 84 AC 74 F7 60 E3 27
CC 58 97
84 AC 74 F7 60 E3 27 C3 68 53 84 AC 74 F7 60 E3 27 CC
58 97
Python Code
Text File content:
iso.3.6.1.4.1.25355.3.2.6.3.2.1.11.1.2.4 = STRING: "785c720855c8"
iso.3.6.1.4.1.25355.3.2.6.4.2.5.1.7.1.2.4.9 = Hex-STRING: 84 16 F9 AF CF 75 84 16 F9 AF E1 35 50 C7 BF F2
F8 4B 70 4F 57 3A C6 23 70 4F 57 3E C5 CD
Code:
w = open("text.txt","r")
for item in w:
for match in re.findall(r'Hex-STRING:\s*(.+)',item):
print match
Output:
84 16 F9 AF CF 75 84 16 F9 AF E1 35 50 C7 BF F2
Output Expected:
84 16 F9 AF CF 75 84 16 F9 AF E1 35 50 C7 BF F2
F8 4B 70 4F 57 3A C6 23 70 4F 57 3E C5 CD