regex in url
hi, urlpatterns = patterns('', (r'^polls/$', 'mysite.polls.views.index'), (r'^polls/(?P\d+)/$', 'mysite.polls.views.detail'), (r'^polls/(?P\d+)/results/$', 'mysite.polls.views.results'), (r'^polls/(?P\d+)/vote/$', 'mysite.polls.views.vote'), ) I am very new to django as well as python. how is it that ?P seems to be ignore by the regex function? I can't see any explanation in django's documentation. is this something magic or hack my django? Thanks james --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: regex in url
On 7/17/07, james_027 <[EMAIL PROTECTED]> wrote: > I am very new to django as well as python. how is it that ?P > seems to be ignore by the regex function? I can't see any explanation > in django's documentation. is this something magic or hack my django? What do you mean by ignored? Are you getting some unexpected behaviour, or are you looking for an explanation of the ?P syntax? Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: regex in url
Yes I am looking for the explanation of ?P syntax, is this something related to python's regex or django's own regex. thanks james On Jul 17, 11:57 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/17/07, james_027 <[EMAIL PROTECTED]> wrote: > > > I am very new to django as well as python. how is it that ?P > > seems to be ignore by the regex function? I can't see any explanation > > in django's documentation. is this something magic or hack my django? > > What do you mean by ignored? Are you getting some unexpected > behaviour, or are you looking for an explanation of the ?P > syntax? > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: regex in url
On 17-Jul-07, at 9:36 AM, james_027 wrote: > Yes I am looking for the explanation of ?P syntax, is this > something related to python's regex or django's own regex. python -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: regex in url
hi kenneth, thanks a lot, i think should be looking at official python doc more than the dive into python. cheers, james On Jul 17, 12:47 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 17-Jul-07, at 9:36 AM, james_027 wrote: > > > Yes I am looking for the explanation of ?P syntax, is this > > something related to python's regex or django's own regex. > > python > > -- > > regards > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: regex in url
For a quick answer: (?Pxxx) means: "match xxx, and store it as a value named blah in the result". This lets the regex machinery build a set of name/value pairs suitable for use as arguments to a view function. --Ned. james_027 wrote: > hi kenneth, > > thanks a lot, i think should be looking at official python doc more > than the dive into python. > > cheers, > james > > On Jul 17, 12:47 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > >> On 17-Jul-07, at 9:36 AM, james_027 wrote: >> >> >>> Yes I am looking for the explanation of ?P syntax, is this >>> something related to python's regex or django's own regex. >>> >> python >> >> -- >> >> regards >> kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ >> > > > > > > > -- Ned Batchelder, http://nedbatchelder.com --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: regex in url
On 7/16/07, james_027 <[EMAIL PROTECTED]> wrote: > Yes I am looking for the explanation of ?P syntax, is this > something related to python's regex or django's own regex. Ned's quick answer below is quite clear, I think, but if you'd like more details from the horse's mouth (as it were), the official Python docs on regular expressions can be found here: http://docs.python.org/lib/re-syntax.html Jacob --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---