1

I am learning Google App Engine in Python.

Here is my problem:

I want the visitor to visit my website in the following format,

hxxp://www.example.com/wiki/A_Example_Title

The variable after /wiki/ only contains alphabets and underscore.

application = webapp.WSGIApplication([
    ('/wiki/??????', wikipage),

What should the ???? part be?

Thanks a lot!

2
  • What are you asking? Why do you need a regex for this? Commented Dec 5, 2010 at 20:31
  • I think (\w+) is a regular expression.bgporter's answer is absolutely what I need. Thank you 4 asking Falmarri. Commented Dec 6, 2010 at 17:36

1 Answer 1

4

try one of these:

Your spec said 'alphabets and underscore' -- this one gets that and numbers as well:

r'/wiki/(\w+)'

...if you really don't want numbers in there, use this:

r'/wiki/([A-Za-z_]+)'

The characters captured by that regex will be passed as a parmeter to your wikipage get() handler.

Sign up to request clarification or add additional context in comments.

1 Comment

This is the answer I need! Kiss bgporter~~~

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.