Re: regex problem in django

2009-06-29 Thread James Gregory
On Jun 29, 2:57 pm, Joru wrote: > Still doesn't work even I remove wrap function :( So it seems your regex is incorrect, the problem is not related to Django. If you paste your code here I can have a look, but I still think you'd be better off reading a bit more about

Re: regex problem in django

2009-06-29 Thread Joru
Still doesn't work even I remove wrap function :( On Jun 29, 7:35 pm, James Gregory wrote: > On Jun 29, 1:05 pm, Joru wrote: > > > I'm sorry for my typo > > the string var suppose to be like this > > str = "wr:\n one bunny \n two bunny \n wr:\n three

Re: regex problem in django

2009-06-29 Thread James Gregory
On Jun 29, 1:05 pm, Joru wrote: > I'm sorry for my typo > the string var suppose to be like this > str = "wr:\n one bunny \n two bunny \n wr:\n three bunny \n > So every match string "wr:" should had "+" in front of it line > the one that confuse me is that my function work

Re: regex problem in django

2009-06-29 Thread Joru
I'm sorry for my typo the string var suppose to be like this str = "wr:\n one bunny \n two bunny \n wr:\n three bunny \n So every match string "wr:" should had "+" in front of it line the one that confuse me is that my function work in django/python shell, but this regex doesn't work well if i

Re: regex problem in django

2009-06-29 Thread James Gregory
On Jun 29, 11:19 am, Joru wrote: > ah, I just want to match in the end of line only > so change the rule "wr$" would get what I want? > > > Square brackets are for character groups, not literal strings. "wr:" > > is just a string so it should be "wr:", not "[wr:]". Also,

Re: regex problem in django

2009-06-29 Thread Joru
ah, I just want to match in the end of line only so change the rule "wr$" would get what I want? On Jun 29, 4:56 pm, James Gregory wrote: > On Jun 29, 10:49 am, Joru wrote: > > > > > I mean None not null > > When I print rgx always None, that mean

Re: regex problem in django

2009-06-29 Thread James Gregory
On Jun 29, 10:49 am, Joru wrote: > I mean None not null > When I print rgx always None, that mean the regex eval never match > The expected output result would be > > +wr:> one bunny > > two bunny > > + wr: three bunny > > Because everytime found regex rules r'[wr:]$' then

Re: regex problem in django

2009-06-29 Thread Joru
I mean None not null When I print rgx always None, that mean the regex eval never match The expected output result would be +wr: > one bunny > two bunny + wr: three bunny Because everytime found regex rules r'[wr:]$' then should add + in beginning of line On Jun 29, 4:31 pm, James Gregory

Re: regex problem in django

2009-06-29 Thread James Gregory
On Jun 29, 10:05 am, Joru wrote: > I still can't solve this > Anyone had answer on this? > > On Jun 26, 7:39 pm, Joru wrote: > > > Hi, > > > I experience some weirdness regarding usingregexwith django > > I have following function in utils.py > > > from

Re: regex problem in django

2009-06-29 Thread Joru
I still can't solve this Anyone had answer on this? On Jun 26, 7:39 pm, Joru wrote: > Hi, > > I experience some weirdness regarding usingregexwith django > I have following function in utils.py > > from django.utils.text import wrap > import re > > str = "wr: \n one bunny \n

regex problem in django

2009-06-26 Thread Joru
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