记事本++正则表达式如何删除之后的内容

notepad++ regex how to remove whatever after

我有以下用户代理:

Mozilla/5.0 (Linux; Android 8.0.0; LLD-L31 Build/HONORLLD-L31; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/73.0.3683.75 Mobile Safari/537.36 Instagram 84.0.0.21.105 Android (26/8.0.0; 480dpi; 1080x2032; HUAWEI/HONOR; LLD-L31; HWLLD-H; hi6250; ru_RU; 145652094)
Mozilla/5.0 (Linux; Android 8.0.0; SM-J330F Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.100 Mobile Safari/537.36 Instagram 83.0.0.20.111 Android (26/8.0.0; 320dpi; 720x1280; samsung; SM-J330F; j3y17lte; samsungexynos7570; ru_RU; 144612596)
Mozilla/5.0 (Linux; Android 8.0.0; SM-A320F Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36 Instagram 84.0.0.21.105 Android (26/8.0.0; 320dpi; 720x1280; samsung; SM-A320F; a3y17lte; samsungexynos7870; ru_RU; 145652093)
Mozilla/5.0 (Linux; Android 8.0.0; SM-A520F Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/72.0.3626.121 Mobile Safari/537.36 Instagram 85.0.0.21.100 Android (26/8.0.0; 420dpi; 1080x1920; samsung; SM-A520F; a5y17lte; samsungexynos7880; ru_RU; 146536619)
Mozilla/5.0 (Linux; Android 8.0.0; SM-A520F Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/73.0.3683.75 Mobile Safari/537.36 Instagram 85.0.0.21.100 Android (26/8.0.0; 480dpi; 1080x1920; samsung; SM-A520F; a5y17lte; samsungexynos7880; ru_RU; 146536619)
Mozilla/5.0 (Linux; Android 8.0.0; STF-L09 Build/HUAWEISTF-L09; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/72.0.3626.121 Mobile Safari/537.36 Instagram 85.0.0.21.100 Android (26/8.0.0; 480dpi; 1080x1920; HUAWEI/HONOR; STF-L09; HWSTF; hi3660; ru_RU; 146536619)
Mozilla/5.0 (Linux; Android 8.0.0; SM-A605FN Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/72.0.3626.121 Mobile Safari/537.36 Instagram 84.0.0.21.105 Android (26/8.0.0; 420dpi; 1080x2094; samsung; SM-A605FN; a6plte; qcom; ru_RU; 145652094)
Mozilla/5.0 (Linux; Android 8.0.0; G3112 Build/48.1.A.2.73; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36 Instagram 83.0.0.20.111 Android (26/8.0.0; 360dpi; 720x1172; Sony; G3112; G3112; mt6757; ru_RU; 144612598)
Mozilla/5.0 (Linux; Android 8.0.0; RNE-L21 Build/HUAWEIRNE-L21; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/72.0.3626.121 Mobile Safari/537.36 Instagram 84.0.0.21.105 Android (26/8.0.0; 480dpi; 1080x2160; HUAWEI; RNE-L21; HWRNE; hi6250; ru_RU; 145652094)
Mozilla/5.0 (Linux; Android 8.0.0; SM-G935F Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/72.0.3626.121 Mobile Safari/537.36 Instagram 85.0.0.21.100 Android (26/8.0.0; 480dpi; 1080x1920; samsung; SM-G935F; hero2lte; samsungexynos8890; ru_RU; 146536619)

我只是想知道如何使用 Notepad++ 正则表达式提取设备 ID,如下所示:

26/8.0.0; 480dpi; 1080x2032; HUAWEI/HONOR; LLD-L31; HWLLD-H; hi6250; ru_RU; 145652094
26/8.0.0; 320dpi; 720x1280; samsung; SM-J330F; j3y17lte; samsungexynos7570; ru_RU; 144612596
26/8.0.0; 320dpi; 720x1280; samsung; SM-A320F; a3y17lte; samsungexynos7870; ru_RU; 145652093
26/8.0.0; 420dpi; 1080x1920; samsung; SM-A520F; a5y17lte; samsungexynos7880; ru_RU; 146536619
26/8.0.0; 480dpi; 1080x1920; samsung; SM-A520F; a5y17lte; samsungexynos7880; ru_RU; 146536619
26/8.0.0; 480dpi; 1080x1920; HUAWEI/HONOR; STF-L09; HWSTF; hi3660; ru_RU; 146536619
26/8.0.0; 420dpi; 1080x2094; samsung; SM-A605FN; a6plte; qcom; ru_RU; 145652094
26/8.0.0; 360dpi; 720x1172; Sony; G3112; G3112; mt6757; ru_RU; 144612598
26/8.0.0; 480dpi; 1080x2160; HUAWEI; RNE-L21; HWRNE; hi6250; ru_RU; 145652094

我试过很多正则表达式都失败了。有人可以帮助我准确的正则表达式吗,谢谢。

您可以使用以下正则表达式:

^.*Android\s+\(([^)]*)\).*$

将匹配

  • 从字符串开头开始的一些字符数 (^.*),
  • 单词 Android 后跟一些空格 (\s+)
  • 第 1 组 (\(([^)]*)\)) 中捕获的括号 () 中的表达式。
  • 然后是一些字符,直到字符串结尾 (.*$)

将匹配项替换为 (捕获组的内容)。