python - How can I find multiple URLs within a string (href attribute) -


i've written script (see here) urls within template directory, of hrefs contain 2 urls use depending on language app runs in.

so script gives me list of whatever in href='here', want collect urls href looks this;

href="{{ 'http://www.link.com/blah/page.htm'|cy:'http://www.link.com/welsh/blah/page.htm' }}" 

what regular expression need return those? (as many people, i'm awful @ regex!)

something like:

href="{{ 'http://www.link.com/blah/page.htm'|cy:'http://www.link.com/welsh/blah/page.htm' }}"  import re print re.findall("'(http://(?:.*?))'", href) # ['http://www.link.com/blah/page.htm', 'http://www.link.com/welsh/blah/page.htm'] 

takes starting http:// that's inside apostrophes.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -