in django url, ?p<slug>[^\\.] syntax mean?
url( r'^view/(?p<slug>[^\\.]+)/$', 'blog.views.view_post', name='view_blog_post')),
in python regex, (?p<name>regex) called named capturing group
so (?p<slug>[^\\.]+) capture character not of backslash or dot 1 or more times , store matches inside group name slug.
then may refer captured chars specifying it's index number or group name.
Comments
Post a Comment