Matching something or the end of the content
Question: How can I ask to look for a word followed by `%`, this special character being
optional if the word is at the end of the text to analyze ?

The following code prints only `showme` but I would also like to have `metoo`.

    
    
    #! /usr/bin/env python3
    
    import re
    
    p = re.compile(r"(?<!@)\w+(?=%)")
    
    for m in p.finditer(r"@hideme showme% metoo"):
        print(m.group())
    


Answer: Simple look for \% OR $ (the end of text char).

` p = re.compile(r"(?<!@)\w+(?=%|$)") `

