如何扩展正则表达式以排除文件夹中的所有文件? [英] How do I extend a regular expression to exclude all files in a folder?

查看:289
本文介绍了如何扩展正则表达式以排除文件夹中的所有文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Google App Engine项目的app.yaml文件中,有一个skip_files部分用于排除上传给定类型的文件。如何扩展此正则表达式以排除整个gaeunit目录的上传?

  skip_files:| 
^(。* /)?(
(app\.yaml)|
(index\.yaml)|
(\ .. *)| $ b $ .b(。* \.pyc)|
(。* \.bat)|
(。* \.psd)|
(Thumbs.db)|
。(。* \.svn /.*)|
(。* \.lnk)|
(。* \.datastore)|
(_darcs /.*)|
(nbproject /.*)|
(。* \.swp)|
(。* \.log)|
)$

解决方案

nbproject 和 darcs 目录不包含在上述正则表达式中。

 (gaeunit /.*)| 


In the app.yaml file of my Google App Engine project there is a skip_files section used to exclude files of given types from being uploaded. How do I extend this regular expression to exclude the entire gaeunit directory from being uploaded?

skip_files: |
    ^(.*/)?(
    (app\.yaml)|
    (index\.yaml)|
    (\..*)|
    (.*\.pyc)|
    (.*\.bat)|
    (.*\.psd)|
    (Thumbs.db)|
    (.*\.svn/.*)|
    (.*\.lnk)|
    (.*\.datastore)|
    (_darcs/.*)|
    (nbproject/.*)|
    (.*\.swp)|
    (.*\.log)|
    )$

解决方案

The same way the nbproject and darcs directories are excluded in the above regular expression. Add this line anywhere before the last line:

(gaeunit/.*)|

这篇关于如何扩展正则表达式以排除文件夹中的所有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆