[Solved] Regex replace `a.b` to `a. b`? [duplicate]
You can use the following ([abAB])\.([abAB]) >>> import re >>> s = [‘a.b’, ‘A.b’, ‘a.B’, ‘A.B’] >>> [re.sub(r'([abAB])\.([abAB])’, r’\1. \2′, i) for i in s] [‘a. b’, ‘A. b’, ‘a. B’, ‘A. B’] The issue with your approach is that you are not saving capturing groups to use in the result of the substitution. If … Read more