Re: Regular expression and substitution, unexpected duplication

2015-08-19 Thread Laurent Pointal
MRAB wrote: > On 2015-08-18 22:42, Laurent Pointal wrote: >> Hello, >> ellipfind_re = re.compile(r"((?=\.\.\.)|…)", re.IGNORECASE|re.VERBOSE) >> ellipfind_re.sub(' ... ', >> "C'est un essai... avec différents caractères… pour voir.") > (?=...) is a lookahead; a non-capture group is (?:..

Re: Regular expression and substitution, unexpected duplication

2015-08-18 Thread MRAB
On 2015-08-18 22:42, Laurent Pointal wrote: Hello, I want to make a replacement in a string, to ensure that ellipsis are surrounded by spaces (this is not a typographycal problem, but a preparation for late text chunking). I tried with regular expressions and the SRE_Pattern.sub() method, but I

Regular expression and substitution, unexpected duplication

2015-08-18 Thread Laurent Pointal
Hello, I want to make a replacement in a string, to ensure that ellipsis are surrounded by spaces (this is not a typographycal problem, but a preparation for late text chunking). I tried with regular expressions and the SRE_Pattern.sub() method, but I have an unexpected duplication of the repl