Python regex: Remove a pattern at the end of string
Question: Input: `blah.(2/2)`

Desired Output: `blah`

Input can be "blah.(n/n)" where n can be any single digit number.

How do I use regex to achieve "blah"? This is the regex I currently have which
doesn't work:

    
    
    m = re.sub('[.[0-9] /\ [0-9]]{6}$', '', m)
    


Answer: You need to use regex `\.\(\d/\d\)$`

    
    
    >>> import re
    >>> str = "blah.(2/2)"
    >>> re.sub(r'\.\(\d/\d\)$', '',str)
    'blah'
    

**[Regex explanation here](https://regex101.com/r/uB8vX3/2)**

![Regular expression
visualization](https://www.debuggex.com/i/0OCKYmNVzwWQbubU.png)

