import re from django.utils.encoding import smart_unicode r_lightbox = re.compile(']*\.(jpg|gif|png))(?![^>]*lightbox)') s_lightbox = '