Match the folder list by using regex in python
Question: How to match the following case in python regex,

    
    
    str = "https://10.0.4.3/myrepos/Projects/ID87_070_138"
    

I need to match "ID87_070_138" this type of folders from the list of folders.

    
    
    The pattern is "ID<number>_<number>_<Number>".
    

Thanks in advance.


Answer: 
    ID\d+_\d+_\d+
    

Matches the `ID` followed by three groups of _one_ or _more_ digits, separated
by underscore.

And the Python code:

    
    
    > import re
    > str = "https://10.0.4.3/myrepos/Projects/ID87_070_138"
    > print re.findall(r"ID\d+_\d+_\d+", str)
    

With the result:

    
    
    ['ID87_070_138']
    

