View Single Post
Old 05-30-2018, 07:35 AM   #1
bobbysteel
Big Poppa
bobbysteel began at the beginning.
 
Posts: 110
Karma: 10
Join Date: Jul 2010
Device: Nook
How to do back-matches with preprocess_regexp

Hi Kovid et al
I'm trying to use preprocess_regexps more powerfully to do some rewriting and can't seem to make the back-matching work properly.
Code:
(re.compile(r'<li class="css.*?>(.*?)</li>', re.IGNORECASE), lambda match: '')
Sorry for the stupid question, but how could I perform the substitution such that the match would replace with the group(0) of that regexp match? match: group(0) fails.
bobbysteel is offline   Reply With Quote