在ubot中使用正则表达式匹配图像

Matching images with regex in ubot

本文关键字:图像 正则表达式 ubot      更新时间:2023-09-26

我试图在ubot studio中使用regex匹配具有相同分辨率的图像。

我想要匹配的示例图像url:

http://sample.com/Image/e7b89db921da411bae9eea3c1333f287/201605/word/word/640/480/imagename.jpeg
http://sample.com/Image/a3c133e411bae9ee3f287b89db921da7/201504/word/word/640/480/imagename2.jpeg
http://sample.com/Image/41187b89db921dbae9ee3f2a3c133ea7/201505/word2/word/640/480/imagename3.jpeg

,但不匹配图像,如:http://sample.com/Image/fdsfsdf.jpeg或其他图像。我从^(http.+)'.jpeg$开始,但它匹配所有图像。我需要这样写:

http://sample.com/Image/*/*/word/word/640/480/*.jpeg

您的url中有一个包含word2,因此您的正则表达式不匹配。

试试这个http:'/'/sample.com'/Image'/.*?'/.*?'/word2?'/word'/('d+)'/('d+)'/.*?'.jpeg

示例

也可以使用:

.*'/word'/640'/480'/.*