Reputation: 4565
Hey, how do I match the url that starts with digits which are followed by "?fmt=json", like 1234?fmt=json return true but my another wep handler which handles the urls that are all digits like 1234 return false? I have tried \d+(?!\?fmt=json) which is supposed match the url where the digits are not followed by "?fmt=json", but it doesnt work. any helps? thank you
Upvotes: 1
Views: 111
Reputation: 101149
You can't match the query string in App Engine's webapp, or most other Python webapp frameworks. It's a rather odd thing to want to do, too - your handler should fetch the value of the argument, and modify its output based on that.
Upvotes: 0
Reputation: 7110
This regular expression only matches when the fmt=json suffix is there and will "return false" if only numbers:
\d+\?fmt=json
Like
http://something/1234?fmt=json == true, (match=1234?fmt=json)
http://something/1234 == false
Upvotes: 3