按照你的要求,寫的正則表示式 ^(.+?\s+)(((\d+(\.\d+)*)|(BN\d+)).*?)$
完整的Python語言的程式如下
#!/usr/bin/python
import re
a = "Microsoft .NET Framework 3.5.1\r\nHP Network Automation 9.1X\r\n2345安全衛士 Security Guard 3.7\r\nIntel BN0049\r\nNetGain Systems Enterprise Manager 7.2.699 build 1001\r\nMicrosoft Windows 10 1703"
regex_str = r"^(.+?\s+)(((\d+(\.\d+)*)|(BN\d+)).*?)$"
it = re.finditer(regex_str,a,re.I|re.M)
for match in it:
print(match.group(1)+"|"+match.group(2))
按照你的要求,寫的正則表示式 ^(.+?\s+)(((\d+(\.\d+)*)|(BN\d+)).*?)$
完整的Python語言的程式如下
按照你的要求,寫的正則表示式 ^(.+?\s+)(((\d+(\.\d+)*)|(BN\d+)).*?)$
完整的Python語言的程式如下
#!/usr/bin/python
import re
a = "Microsoft .NET Framework 3.5.1\r\nHP Network Automation 9.1X\r\n2345安全衛士 Security Guard 3.7\r\nIntel BN0049\r\nNetGain Systems Enterprise Manager 7.2.699 build 1001\r\nMicrosoft Windows 10 1703"
regex_str = r"^(.+?\s+)(((\d+(\.\d+)*)|(BN\d+)).*?)$"
it = re.finditer(regex_str,a,re.I|re.M)
for match in it:
print(match.group(1)+"|"+match.group(2))