John Bokma wrote:

A Perl programmer will call this line noise:

double_word_re = re.compile(r"\b(?P<word>\w+)\s+(?P=word)(?!\w)",
                            re.IGNORECASE)
for match in double_word_re.finditer(text):
    print ("{0} is duplicated".format(match.group("word"))

Actually, Python programmers would tend to call the RE part
of that line noise, too.

It's for that reason that we tend to avoid using REs when
possible, reaching for them only as a tool of last resort.

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to