Using findall function in module re for python
Question: I wrote code like this:

    
    
    >>> import re
    >>> url='<a href="C:\python34\koala.jpg">jpg</a><font size="10">'
    >>> print(re.findall('href="(.*?)"><',url))
    

I except result

    
    
    C:\python34\koala.jpg">jpg</a 
    

But I can see only this result :

    
    
    []
    

why is this happening?

I did not know why I have this result in console.  
Please help me.  
I am using python 3.4 and windows8.1.


Answer: Are you sure you want the `>jpg</a` part too. If yes then you can use this:

    
    
    >>> re.findall('href="([^"]*">[^<]*</a)',url)
    ['C:\\python34\\koala.jpg">jpg</a']
    

If you need only the `href` attributes value then you can use:

    
    
    >>> re.findall('href="([^"]*")',url)
    ['C:\\python34\\koala.jpg"']
    

