I am trying to print an ID after VersionInfo. VersionInfo is in a text file with other values also. If I am just using [\b\d+\d+\.\d+\.\d+\.\d+\d+\d+\d+\b])+
, It is giving me all the values in the text file. So i added VersionInfo at the start but it is giving me no output.
file.txt:VersionInfo10.2.3.4442
期望的输出量:10.2.3.4442
这是我正在使用的代码
import re
inputtext = open('File.txt', 'r', encoding='latin1')
inputtext1 = inputtext.read()
matches = re.findall(r'VersionInfo([\b\d+\d+\.\d+\.\d+\.\d+\d+\d+\d+\b])+', inputtext1)
for match in matches:
print(match)
Remove
[]
and\b