Gruntfile中的简单正则表达式 [英] Simple regex in Gruntfile
问题描述
我在 Gruntfile
中有以下行。
js
文件:['<%= yeoman.app%> / scripts / {,* /} *。咖啡'],
有人可以告诉我什么 {,* /} *
是什么意思?我知道它试图匹配脚本文件夹中的所有 .coffee
文件,但我想知道它是如何做到这一点的。
Could someone be so kind as tell me what {,*/}*
mean? I know it's trying to match all .coffee
files in the scripts folder, but I want to know how it does that.
推荐答案
在{}内部实际上有两个用逗号分隔的匹配项。一个是空白的,在逗号左边没有字符。一个是任意数量的字符和一个正斜杠。最后的*匹配.coffee扩展名前的文件名。
The {,*/}
matches one or zero directories between scripts and the .coffee file. Inside the {} there are actually two matching terms separated by a comma. One is blank, represented by no characters to the left of the comma. One is any number of characters and a forward slash. The final * matches the filename before the .coffee extension.
顺便说一句,这不是正则表达式,它是通配符。
By the way, this is not regular expressions, it's globbing.
这篇关于Gruntfile中的简单正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!