正则表达式,过滤器 url 以和不以数字结尾

Regex, filter url ending with and without digit

我有以下四个 URL,我只想使用正则表达式过滤其中的两个。

/chassis/motherboard/cpu <---- 这个

/chassis/motherboard/cpu/core0

/chassis/motherboard/cpu0 <---- 这个

/chassis/motherboard/cpu1/core0

我试过 ^.*[0-9a-z_].cpu 但我无法找到解决方案。

您可以使用这个正则表达式:

^.*/cpu[0-9]*$

这将匹配任何以 /cpu/cpy<number>

结尾的文本