python regex re.compile() match string
Question: Gents, I am trying to grab the version number from a string via python
regex...

Given filename: facter-1.6.2.tar.gz  

When, inside the loop:

    
    
    import re
    version = re.split('(.*\d\.\d\.\d)',sfile)
    print version
    

How do i get the 1.6.2 bit into version

Thanks!


Answer: 
    match = re.search(r'\d\.\d\.\d', sfile)
    if match:
        version = match.group()
    

