3👍
✅
The problem is that your regexp doesn’t match the whole URL because the pattern ends with a slash, and your URL doesn’t.
But since regexp without an explicit $
at the end matches a prefix of a string, if you’ll have a look at your match
variable you’ll notice that it is user/
, not user/3
as you might expect.
Update: (more verbose explanation)
r'^blog/.*/'
matches [blog/user/]
and [blog/user/]3
(square brackets used to denote actually matched parts).
If you try r'^blog/.*/$'
you’ll notice that blog/user/3
won’t match at all since there is not slash at the end.
Source:stackexchange.com