I’ve seen some URLs regexps ending with a $ in a Tornado app that was handed to my team… Maybe I’m not the most web literate guy and this is obvious for others, but I don’t see the difference it makes to explicitly indicate the end of line when matching the whole string (not searching inside).
Is there something that I’m missing or it is just redundant?
edit to make clearer what I mean:
handlers = [
tornado.web.URLSpec(r'/About/$', ShowSettingsHandler),
...
]
that should be exactly the same as:
handlers = [
tornado.web.URLSpec(r'/About/', ShowSettingsHandler),
...
]
as the handler dispatcher looks for an exact match, not a substring.
There is no need for the trailing
$in Tornado. I put them in out of habit, and because I think it’s clearer, butr"^/hello"will ONLY match /hello.We can see this by looking at the URLSpec source: