Re: Extracting repeated words

2011-04-02 Thread candide
Le 02/04/2011 00:42, Ian Kelly a écrit : You could use a look-ahead assertion with a captured group: regexp = r'\b(?P\w+)\b(?=.+\b(?P=dup)\b)' c = re.compile(regexp, re.IGNORECASE | re.DOTALL) c.findall(text) It works fine, lookahead assertions in action is what exatly i was looking for, ma

Re: Extracting repeated words

2011-04-01 Thread Ian Kelly
On Fri, Apr 1, 2011 at 2:54 PM, candide wrote: > Another question relative to regular expressions. > > How to extract all word duplicates in a given text by use of regular > expression methods ?  To make the question concrete, if the text is > > -- > Now is better than never. > Alt

Extracting repeated words

2011-04-01 Thread candide
Another question relative to regular expressions. How to extract all word duplicates in a given text by use of regular expression methods ? To make the question concrete, if the text is -- Now is better than never. Although never is often better than *right* now. -