In the following url:
(r'^videos/view/(?P<video_id>[^/]+)/$'
- What does the
r'mean/do? - What does the
?Pmean/do? - How is the
<video_id>escaped by the regex?
In other words, how is the above different than:
'^/videos/view/[^/]+/$'
r'' marks a raw string, so that you don't have to double-escape backslashes. In this case, it's not necessary because there aren't any, but a lot of people always do it for regexes anyway.
(?P<video_id>[^/]+) is a Python extension to regexes that "names" that capture group video_id. In Django, this means that the match is sent to the view as a keyword argument video_id; if you did view/([^/]+)/$, it would be sent as the first positional argument. In your example, though, there are no parens at all, meaning that the view wouldn't get any arguments!