Rahul Maheshwari Rahul Maheshwari - 7 months ago 51
Python Question

Regex, filter url ending with and without digit

I have below four url out of which I want to filter only two using regex expression.

/chassis/motherboard/cpu <---- this


/chassis/motherboard/cpu0 <---- this


I have tried to play around with ^.*[0-9a-z_].cpu but unable to get the solution.


You can use this regex:


This will match any text that ends with /cpu or /cpy<number>