用于检测图像格式名称的正则表达式

regular expression for detect formated name of images

我需要检测 ended 维度 (NUMxNUM) 的图像或一些静态词,如 (icon,small,normal,large)

已加星标的项目是当前规则:

/test/abcd/files/01_aa_100x200.jpg *
/test/abcd/files/abcd_221x105.jpg *
/test/abcd/files/01_aa_icon.jpg *
/test/abcd/files/01aa_iconblabla.jpg
/test/abcd/files/aa_small.jpg *
/test/abcd/files/aa0_test.jpg

我用这个,但目前不能用

\/([0-9a-z-]{1,})\/([0-9a-f]{2})([0-9a-f]{2})\/(.+)\_[x0-9|small|icon|normal|large](.+)\.(jpg|png|gif|jpeg)

Demo

尝试以下操作:

\/([0-9a-z-]+)\/([0-9a-f]{2})([0-9a-f]{2})\/(.+)\_(\d+x\d+|small|icon|normal|large)\.(jpg|png|gif|jpeg)

Demo