记事本++;regex如何从此列表中提取用户ID
我的名单如下:记事本++;regex如何从此列表中提取用户ID,regex,notepad++,Regex,Notepad++,我的名单如下: originalscrape,scrapeDate,userId,username,full_name,is_private,follower_count,following_count,media_count,biography,hasProfilePic,external_url,email,contact_phone_number,address_street,isbusiness,Engagement %,MostRecentPostDate,AvgLikes,AvgCo
originalscrape,scrapeDate,userId,username,full_name,is_private,follower_count,following_count,media_count,biography,hasProfilePic,external_url,email,contact_phone_number,address_street,isbusiness,Engagement %,MostRecentPostDate,AvgLikes,AvgComments,category,businessJoinDate,businessCountry,businessAds,countryCode,cityName,isverified
,07/03/2020 05:54 AM,="189389157",stronger_together_forever,stronger_together_forever You could use Match the ="
and repeat the group 2 times instead of 3. Then capture 1+ digits.
Note to repeat the character class [^,\r\n]
using *
for 0 or more times.
If you want the digits only, you could replace with group 1 using $1
^(?:[^,\r\n]*,){2}="(\d+)".*
originalscrape,scrapdate,userId,username,全名,is_private,follower_count,follower_count,media_count,传记,hasProfilePic,外部url,电子邮件,联系人电话号码,地址,街道,isbusiness,订婚%,MostRecentPostDate,AvgLikes,AvgComments,category,businessJoinDate,businessCountryCode,cityName,isverified
,07/03/2020 05:54 AM,=“189389157”,永远更强壮,永远更强壮您可以使用匹配=”
并重复组2次而不是3次。然后捕获1+个数字
注意:使用*
重复字符类[^,\r\n]
0次或更多次
如果您只需要数字,可以使用$1
^(?:[^,\r\n]*,){2}="\K\d+(?=")
^
字符串的开头
(?:[^,\r\n]*,){2}
重复2次匹配0或更多次任何字符(逗号或换行符除外),然后匹配,
=”
逐字匹配
(\d+)
捕获组1,匹配1+个数字
“*
匹配”并匹配行的其余部分
如果只需要匹配,可以使用\K
重置匹配缓冲区,然后匹配数字并在右侧声明双引号
(?:AM|PM),=\"(\d+)\"
利用这一优势,AM/PM
格式的时间出现在每个ID之前,并且ID周围有“
字符:
请在查看演示