CDT
CDT

Reputation: 10621

Tornado url regex

I want to get a domain name of a website (such as "www.google.com") as a parameter passing to the handler app = tornado.web.Application(handlers=[(r"/(\w+)", IndexHandler)].

When I run my test file, it failed because "www.google.com" does not match pattern (\w+).

What I know about (\w+) is that it can represent a string of characters. I don't even know whether (\w+) is called Tornado url regex or not, but I want to know more about it.

Upvotes: 1

Views: 4040

Answers (1)

dm03514
dm03514

Reputation: 55962

\w represents word characters

equivelant to [a-zA-Z0-9_]

Upvotes: 4

Related Questions