如何删除除 notpad++ 之外的所有内容

如何删除除 notpad++ 之外的所有内容

这是我的代码

{"UserId":242558405,"AbsoluteURL":"https://www.roblox.com/users/242558405/profile/","Username":"robloxpalyer9349","AvatarUri":"http://imagesak.roblox.com/325472601571f31e1bf00674c368d335.gif","AvatarFinal":true,"OnlineStatus":{"LocationOrLastSeen":"2/23/2017 10:37:05 AM","ImageUrl":"~/images/offline.png","AlternateText":"robloxpalyer9349 is offline (last seen at 2/23/2017 10:37:05 AM."},"Thumbnail":{"Final":true,"Url":"http://imagesak.roblox.com/325472601571f31e1bf00674c368d335.gif","RetryUrl":null,"UserId":242558405,"EndpointType":"Avatar"},"InvitationId":0,"LastLocation":"Offline","PlaceId":null,"AbsolutePlaceURL":null,"IsOnline":false,"InGame":false,"InStudio":false,"IsFollowed":false,"FriendshipStatus":3,"IsDeleted":false},{"UserId":170660795,"AbsoluteURL":"https://www.roblox.com/users/170660795/profile/","Username":"Robloxplayer8348","AvatarUri":"http://imagesak.roblox.com/325472601571f31e1bf00674c368d335.gif","AvatarFinal":true,"OnlineStatus":{"LocationOrLastSeen":"2/20/2018 11:56:41 PM","ImageUrl":"~/images/offline.png","AlternateText":"Robloxplayer8348 is offline (last seen at 2/20/2018 11:56:41 PM."},"Thumbnail":{"Final":true,"Url":"http://imagesak.roblox.com/325472601571f31e1bf00674c368d335.gif","RetryUrl":null,"UserId":170660795,"EndpointType":"Avatar"},"InvitationId":0,"LastLocation":"Offline","PlaceId":null,"AbsolutePlaceURL":null,"IsOnline":false,"InGame":false,"InStudio":false,"IsFollowed":false,"FriendshipStatus":3,"IsDeleted":false},

它比这大很多,我只希望它是 userId 附近的 id:它应该看起来像这样

242558405
170660795

答案1

  • Ctrl+H
  • 找什么:.+?"UserId":(\d+)
  • 用。。。来代替:$1\n
  • 检查环绕
  • 检查正则表达式
  • Replace all

解释:

.+?         : 1 or more any character but newline, not greedy
"UserId"    : literally
(           : start group 1
  \d+       : 1 or more digits
)           : end group

替代品:

$1      : content of group 1
\n      : linefeed, you may change it into \r\n

给定示例的结果:

242558405
242558405
170660795
170660795
,"EndpointType":"Avatar"},"InvitationId":0,"LastLocation":"Offline","PlaceId":null,"AbsolutePlaceURL":null,"IsOnline":false,"InGame":false,"InStudio":false,"IsFollowed":false,"FriendshipStatus":3,"IsDeleted":false},

完成第一步后,您必须手动删除最后一行。
然后它显示:

242558405
242558405
170660795
170660795

相关内容