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

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -