I always try to break my regex's down to their simplest components, then test them here, http://www.regular-expressions.info/javascriptexample.html. Try testing each part of your regex there and see if you can see which part is broken. Also an example url of what you are trying to match would help me to decipher the problem.
I hope this helps,
Brian
-- On Mon, Oct 3, 2011 at 9:56 AM, He Jibo <hejibo@gmail.com> wrote:
Hello,
I want to match a url in urls.py. Can you teach me how to do it? Thanks.I have tried the following two versions. But as long as I put a . (dot) in the regular expression, it gives me a "bad character range" error.
(r'^pagerank/(?P<url>([/w-]+/.)+[/w-]+.([^a-z])(/[/w-: ./?%&=]*)?|[a-zA-Z/-/.][/w-]+.([^a-z])(/[/w-: ./?%&=]*)?)', 'ueseo.pagerank.views.CheckPageRankStatic'),# a static page version of page rank check
(r'^pagerank/(?P<url>[a-zA-Z0-9_-.]+))', 'ueseo.pagerank.views.CheckPageRankStatic'),# a static page version of page rank check
---------------------------
He Jibo
Department of Psychology,
Beckman Institute for Advanced Science and Technology
University of Illinois, Urbana Champaign,
603 East Daniel St.,
Champaign, IL 61820
website: www.hejibo.info
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment