I am very new to regex and python and I am struggling with the following.I have one specific string from a file:
<td align="left">
<(this, '/hdm/SingleDeviceMgmt/getDevice.do?deviceID)>
<ahref="editDevice.do?deviceID=100089">
<do?deviceID/iopp>
GSE5677789
</a>
</td>
<input type="text" name="serialNumber" id="serialNumber"
class="input_field" value="GSE5677789" title="Enter Number. ">
<ahref="editDevice.do?deviceID=100089">
I need to fetch the deviceID which is equal to 100089 from the string.
The python code that I wrote is:
import re
with open('json_conversion.txt') as f:
for line in f:
if "GSE5677789" and 'deviceID' in line:
s=re.search(r'^deviceID=//.*\.',line)
print s
But I am getting is None.
Can anyone please help.