I have a script that loops over several search/replace regex in python, one of those operations is remove trailing spaces I've tried:
re.sub(r"""s+$""", '', str)
re.sub(r""" +$""", r"""""", str)
and
re.sub(r""" +$""", r"""""", str, re.M)
I found several answers that simply recommended using strip
my problem is that I want to integrate this in the regex replace mechanism.