I need to replace two or more repeated punctuation for space on some string.
"asdasdasd - adasdasd asda ------- asda wadsda +-----+ wwww qqqqqq aaaaa"
to
"asdasdasd - adasdasd asda - asda wadsda +- + wwww qqqqqq aaaaa"
Using regex101 app I've created this one:
https://regex101.com/r/vdR5T1/1/
But when I tried on python:
import re
texto = "asdasdasd - adasdasd asda ------- asda wadsda +-----+ wwww qqqqqq aaaaa"
rx = re.compile(r'([[:punct:]])\1{2,}')
texto = rx.sub(' ', texto)
print(texto)
I've got this error:
FutureWarning: Possible nested set at position 2
rx = re.compile(r'([[:punct:]])\1{2,}')
How can I run this (or a similar) regex using python?