view raw
Difender Difender - 1 year ago 37
Python Question

Regexp on specific URL

I have a list of URLS like this :

What I want here is to only take URLS like

Restricted to that, not taking if there is more.

Can you help me out ? :)


The appropriate regex is:


Example of filtering:

>>> for line in lines:
...     if re.match(r'^\w+/){4}$', line):
...         print line