我试图得到一个正则表达式,它将返回所有的配置文件,有些文件有空格,我不想忽略所有的用户,这是我的尝试,
(Profile \s*:)(\s....)
Profile : Infinix S4
Profile : MTN_4G_10A6B1
Profile : Bruteforce
Profile : CMB FINCONAl用户配置文件: MTN_4G_10A6B1所有用户配置文件:MTN_4G_10A6B1所有用户配置文件: CMB极客所有用户配置文件: MTNHyNetflex 5.0Ghz所有用户配置文件: CLASSICMAN-SEYI 4387所有用户配置文件: MD_CMB所有用户配置文件:MD_CMB所有用户配置文件: CMB所有用户配置文件: MTN_4G_D3CC32所有用户配置文件:MTN_4G_D3CC32所有用户配置文件: MTN_4G_D3CCD7所有用户配置文件: NSHS_CMB所有用户配置文件: NSHS_SPOT所有用户配置文件: CPDCL_SERVER1CMB-PH-RM所有用户配置文件: TP-Link_EDBA所有用户配置文件: MERCY
发布于 2022-08-23 10:53:08
import re
text = 'Al User Profile : MTN_4G_10A6B1 All User Profile : Infinix S4 All User Profile: CMB GEEKS All User Profile: MTNHyNetflex 5.0Ghz All User Profile: CLASSICMAN-SEYI 4387'
data = re.finditer(r'(Profile)\s*[:]\s*\w*', text, re.IGNORECASE)
for match in data:
print(match.group(0))结果:
Profile : MTN_4G_10A6B1
Profile : Infinix
Profile: CMB
Profile: MTNHyNetflex
Profile: CLASSICMANhttps://stackoverflow.com/questions/73456998
复制相似问题