Rahul Maheshwari Rahul Maheshwari - 1 year ago 124
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.

Answer Source

You can use this regex:


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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download