Hi, I experience some weirdness regarding using regex with django I have following function in utils.py
from django.utils.text import wrap import re str = "wr: \n one bunny \n two bunny \n wr: three bunny \n def do_regex(text): lines = wrap(text, 55).split('\n') for i, line in enumerate(lines): cmp = re.compile(r'[wr:]$') rgx = cmp.search(line) if rgx: line = "+%s" % line lines[i] = line else : lines[i] = ">%s" % line return '\n'.join(lines) do_regex(str) when calling do_regex() from views.py, I always get rgx null while when I use django shell rgx will have value when match to regex that I declare in cmp var How to fix my regex so it can work inside views.py? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---