What did you base this on? Certainly not the python docs or behavior of any pcre based library.
Regular expressions are capitalist: greedy by default.
The qualifiers *? are there especially to make a match non-greedy.
Quick test:
pcregrep -o '^.*:' /etc/passwd
versus:
pcregrep -o '^.*?:' /etc/passwd
> The .* modifier means "match any character (.) zero or more times
> (*)". Since blank/ matches the .* zero times, it is a match for your
> expression.
Yeah...you're right. This is why I should stop responding on my phone when I'm tired. No idea why I was thinking that non-greedy was default.
In [4]: bool(re.match(r'^blank/.*$', 'blank/abc'))
Out[4]: True
In [5]: bool(re.match(r'^blank/.*$', 'blank/'))
Out[5]: True
Thank you for catching that. Not sure what was going through my head.
And his problem is that it does *not* match. Not that it does.
And for that I think my statement still stands that Django is stripping the last portion of the URL as a GET argument. I'm betting that requests.GET.get('abc') will return '12/' per the last example from the OP.
-James
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXvuyOMnW%2BBBVqKwzGuCneBvNJ2Kgv8KpGa8C%2BawE826A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment