简体   繁体   English

匹配所有内容的python正则表达式是什么?

[英]What is the python regex to match everything?

So I have a django site with only 1 app, but I want to maintain the suggested folder structure so I want all incoming requests to the root url conf to go to that 1 app's urls.py 因此,我有一个只有1个应用程序的django网站,但我想保留建议的文件夹结构,因此我希望所有对root url conf的传入请求都转到该1个应用程序的urls.py。

Essentially I have a structure like 本质上我有一个像

site/  
    site/
        urls.py
        settings.py
        ...
    app/
        urls.py
        ...

And I want site/urls.py to simply look like this 我希望site / urls.py看起来像这样

url(r'*matching anything here*', include('app.urls')),

I just can't figure out how to make a regex expression to match any set of characters of any length. 我只是不知道如何使正则表达式匹配任何长度的任何字符集。 Essentially EVERYTHING. 基本上一切。

I tried using 我尝试使用

r'(?i).' 

but it still seems to fail 但它似乎仍然失败

For include you need to give the path prefix; 对于include您需要提供路径前缀; it's ^ in this case: 在这种情况下是^

url(r'^', include('app.urls')),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM