I'm trying to match a Django URL bit that can contain:
_
, %
, &
, +
, 0-9
, a-z
, A-Z
, (space)
How can I do it so it is picked up by Django's URL matcher, in form of a parameter?
(r'^(?P<chararg>\w+)/IT_NEEDS_TO_BE_HERE/(?P<intarg>\d+)', 'dest')
I am not so sure about % char, but regex would be [_%&+0-9a-zA-Z ]+
As \w
means [a-zA-Z0-9_]
, you could use :
[%&+ \w]+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With