I have set of image paths like these:
(我有这样的图像路径集:)
a/asstes/ui/img1.png
b/nested/source/ui/img.jpg
...
idea is that path to image and it's name can me random, but important parts are that image is inside ui
folder and has extension of jpg
or png
.
(想法是图像的路径及其名称可以随意,但重要的部分是图像位于ui
文件夹中,并具有jpg
或png
扩展名。)
What regex can I use to check filepath for these conditions?
(我可以使用哪些正则表达式来检查这些条件的文件路径?)
Thus far I got to this point /\ui\/img1\.(png|jpg)$/
this matches a/asstes/ui/img1.png
correctly, but ideally img1
should be dynamic as file name can be anything.
(迄今为止,我走到这一步/\ui\/img1\.(png|jpg)$/
此相匹配a/asstes/ui/img1.png
正确的,但理想img1
应该是动态的文件名可以是任何东西。)
EDIT ideally it will match images that are directly under /ui
(编辑理想它将匹配直属图像/ui
)
ask by Ilja translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…