Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python中的正则表达式-匹配所有不包含。。。(应用程序引擎)_Python_Regex_Google App Engine - Fatal编程技术网

Python中的正则表达式-匹配所有不包含。。。(应用程序引擎)

Python中的正则表达式-匹配所有不包含。。。(应用程序引擎),python,regex,google-app-engine,Python,Regex,Google App Engine,刚开始使用App Engine的webapp框架,但我不知道这有什么问题: 我的URL结构设置为任何页面都以/x/作为前缀。例如 等等等等 现在,我希望能够将不带前缀的/x/与另一个处理程序进行匹配。这将是一个用户的页面 例: 这是我的WSGI应用程序 application = webapp.WSGIApplication([ ('/((?!/x/).)*$', Profile.ProfileMainHandler), ('/x', Misc.Ma

刚开始使用App Engine的webapp框架,但我不知道这有什么问题:

我的URL结构设置为任何页面都以/x/作为前缀。例如

等等等等

现在,我希望能够将不带前缀的/x/与另一个处理程序进行匹配。这将是一个用户的页面

例:

这是我的WSGI应用程序

        application = webapp.WSGIApplication([
      ('/((?!/x/).)*$', Profile.ProfileMainHandler),
      ('/x', Misc.MainHandler),
      ('/x/', Misc.MainHandler),
      ('/x/videos', Videos.VideoHandler),
      ('/x/videos/add', Videos.VideoAddHandler),
              # etc etc, many more to list...
为什么这不起作用?/x/etc处理程序工作正常,但它与Profile.ProfileMainHandler中的任何内容都不匹配


一如既往地感谢您的耐心

应该是这样的:

URL是按顺序匹配的,从第一个到最后一个。只需在所有匹配
/x
的URL模式之后添加一个
*
正则表达式

'^/(?!x/|x$).*$'
'^/(?!x/|x$).*$'