gpt4 book ai didi

regex - 从字符串中提取分辨率

转载 作者:太空宇宙 更新时间:2023-11-04 09:46:13 24 4
gpt4 key购买 nike

我有以下字符串

Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 5238 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 58 tbc

and I try to extract 1280x720,

I used

sed -r 's/.+([0-9]{3,5})x([0-9]{3,5}).+/\1x\2/' 

但它只会返回 280x720

最佳答案

grep 可能有帮助:

grep -Po '\d{3,5}x\d{3,5}'

关于regex - 从字符串中提取分辨率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16039144/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com