View Single Post
Old 01-03-2011, 11:50 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Try
Code:
categories_collapsed_name_template = r'{first.sort:re((.*?)(\,|$).*,\1)} - {last.sort:re((.*?)(\,|$).*,\1)}'
Beyond the re itself, the trick here (one that I had forgotten about) is the "r" in front of the quote. That tells python to not process any of the backslashes in the string. Without the r, the backslashed characters get converted to something else.

I think I will change the tweak so that the 'r' is there by default.
chaley is offline   Reply With Quote