如何使用正则表达式仅提取双引号内的数字
How to extract only numbers inside of double quotes with regex
useragent "VeracodeJenkinsPlugin/18.11.5.8 (Jenkins/2.150.3; Java/1.8.0_181)"
16:02:43.582 [19.07.18 14:02:43]
16:02:43.582 [19.07.18 14:02:43] Application profile "Cleared Derivatives Solution" (appid=74386) was located.
16:02:43.582 [19.07.18 14:02:43]
16:02:43.582 [19.07.18 14:02:43] Attempting to create a new build with name "veracode_scan_2019.7.0_1".
16:02:45.844 [19.07.18 14:02:45]
16:02:45.844 [19.07.18 14:02:45] The build_id of the new build is "4538017".
16:02:45.845 [19.07.18 14:02:45]
16:02:45.845 [19.07.18 14:02:45] Uploading: /somepath/nodecontrolleripp.jar
16:02:48.433 [19.07.18 14:02:48]
16:02:48.433 [19.07.18 14:02:48] Starting pre-scan verification for application "Cleared Derivatives Solution" build "veracode_scan_2019.7.0_1".
[Pipeline] }
[Pipeline] // withCredentials
你好,在这种情况下,我只想得到像 4538017 这样的数字,不带双引号 build_id,这样我就可以将它存储在变量中并在以后使用它。
尝试了来自互联网的许多解决方案,使用:https://regexr.com/
但是 none 成功了,我不断收到双引号和里面的数字。
您需要对引号使用 zero-width 断言,/(?<=")\d+(?=")/g
useragent "VeracodeJenkinsPlugin/18.11.5.8 (Jenkins/2.150.3; Java/1.8.0_181)"
16:02:43.582 [19.07.18 14:02:43]
16:02:43.582 [19.07.18 14:02:43] Application profile "Cleared Derivatives Solution" (appid=74386) was located.
16:02:43.582 [19.07.18 14:02:43]
16:02:43.582 [19.07.18 14:02:43] Attempting to create a new build with name "veracode_scan_2019.7.0_1".
16:02:45.844 [19.07.18 14:02:45]
16:02:45.844 [19.07.18 14:02:45] The build_id of the new build is "4538017".
16:02:45.845 [19.07.18 14:02:45]
16:02:45.845 [19.07.18 14:02:45] Uploading: /somepath/nodecontrolleripp.jar
16:02:48.433 [19.07.18 14:02:48]
16:02:48.433 [19.07.18 14:02:48] Starting pre-scan verification for application "Cleared Derivatives Solution" build "veracode_scan_2019.7.0_1".
[Pipeline] }
[Pipeline] // withCredentials
你好,在这种情况下,我只想得到像 4538017 这样的数字,不带双引号 build_id,这样我就可以将它存储在变量中并在以后使用它。 尝试了来自互联网的许多解决方案,使用:https://regexr.com/ 但是 none 成功了,我不断收到双引号和里面的数字。
您需要对引号使用 zero-width 断言,/(?<=")\d+(?=")/g