本文介绍了Notepad++regex如何从此列表提取用户ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下列表:
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 🌈🏖☀️,False,0,0,0,,False,,,,,No,0,Has no posts.,0,0,,,,,,,No
,07/03/2020 05:54 AM,="51807820",aaronistattoo,Aaron Is.,False,0,0,0,,False,,,,,No,0,Has no posts.,0,0,,,,,,,No
,07/03/2020 05:54 AM,="194962598",djcoley727,djcoley727,False,0,0,0,,False,,,,,No,0,Has no posts.,0,0,,,,,,,No
,07/03/2020 05:54 AM,="4182106610",cesararce1985,Cesar Arce,False,0,0,0,,False,,,,,No,0,Has no posts.,0,0,,,,,,,No
,07/03/2020 05:54 AM,="8957742561",minkwhiz,𝕄𝕚𝕟𝕜𝕎𝕙𝕚𝕫,False,0,0,0,,False,,,,,No,0,Has no posts.,0,0,,,,,,,No
我只想获取userID,如下所示:
189389157
51807820
194962598
4182106610
8957742561
我已使用^(?:[^,]*,){3}([^,]+).*
,但它会给我用户名和用户名,我需要的是用户ID。
我希望有人能帮助我找到正确的Regex,以便仅提取userid。
谢谢
推荐答案
您可以使用匹配="
并将组重复2次而不是3次,然后捕获1+个数字。
注意使用*
将字符类[^,]
重复0次或多次。
如果您只需要数字,可以使用$1
替换为组1
^(?:[^,
]*,){2}="(d+)".*
^
字符串开头(?:[^,]*,){2}
重复2次匹配除逗号或换行符以外的任何字符0次或更多次,然后匹配,
="
逐字匹配(d+)
捕获组1,匹配1+位".*
匹配该行的睡觉(&Q)
如果只需要匹配,可以使用K
重置匹配缓冲区,然后匹配数字并在右侧断言双引号。
^(?:[^,
]*,){2}="Kd+(?=")
这篇关于Notepad++regex如何从此列表提取用户ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!