backreferences

Amy Dillavou gs2luv at line72.net
Wed Sep 28 11:36:21 EDT 2005


George and Iain -
Thanks for your help!!!  It worked for me, and that book seems to be
really useful =)
A.D

On Wed, 2005-09-28 at 11:16 -0400, George Sakkis wrote:
> "Amy Dillavou" <gs2luv at line72.net> wrote in message
> news:mailman.1084.1127915597.509.python-list at python.org...
> > Can someone help me with understanding how python uses backreferences?
> > I need to remember the item that was last matched by the re engine but i
> > cant seem to understand anything that I find on backreferences.  if I
> > want to access the last match do i use \number or is there something
> > else i have to do?
> >
> > heres part of my code:
> > renDate = re.compile("$((\d){4}-(\d){2}-(\d){2}))")
> > renDate.search(l)
> > if(exist.search(l) and str(lastmodDate) < \1): #i need help here with \1
> >
> > Thanks in advance
> > A.D
> 
> renDate = re.compile(some_regex)
> match = renDate.search(input)
> if match and str(lastmodDate) < match.group(1):
>     do_something()
> 
> 
> HTH,
> George
> 
> 




More information about the Python-list mailing list