简体   繁体   English

正则表达式匹配文件路径不起作用

[英]Regex matching file path doesn't work

I'm having a problem with a regular expression and i think that should be pretty easy for you.我在使用正则表达式时遇到了问题,我认为这对您来说应该很容易。

I need a regex that matches the file path like this:我需要一个与文件路径匹配的正则表达式,如下所示:

Matching all files (xxx.test.less) into app/views/ and relative sub folders将所有文件 (xxx.test.less) 匹配到 app/views/ 和相关的子文件夹中

I've been trying for days already but i can't find the right regex to fit my needs.我已经尝试了好几天,但我找不到合适的正则表达式来满足我的需求。

i tried:我试过:

app\/views\/[.test.less]
app\/views\/*.test.less
app\/views\/^.test.less

and many more but with no luck..还有更多,但没有运气..

here's the regex playground with a file structure:这是具有文件结构的正则表达式游乐场:

http://regexr.com/3c5jt http://regexr.com/3c5jt

thanks for any help.谢谢你的帮助。

EDIT编辑

This regular expression needs to be used with brunch config file ( https://github.com/brunch/brunch/blob/stable/docs/config.md ) and currently none of the solutions are working.此正则表达式需要与早午餐配置文件( https://github.com/brunch/brunch/blob/stable/docs/config.md )一起使用,目前没有任何解决方案有效。

由于您将在brunch使用它,请尝试:

/app\/views\/.*?\.test\.less$/

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

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