0

I need to be able to exclude some directories and file extensions in a single line using regex. I can get them working individually, but I'm not quite sure how to merge them together.

Directories: fileExclusionRegExp: /^(media|node_modules)$/

File Extentions: fileExclusionRegExp: /^(r|build|min)\.js$/

So what I'm looking for is a one line like fileExclusionRegExp: /^(media|node_modules)|(min)\.js$/, but my attempts don't work. Any thoughts? Is there another way to handle this using requirejs and r.js node optimizer?

Update: I didn't mention it, but for the file extensions I want to to find anything with that suffix.

4

1 回答 1

0

尝试这个:

fileExclusionRegExp: /^(?:media|node_modules|(?:r|build|min)\.js)$/

基本相同,但使用捕获组:

fileExclusionRegExp: /^(media|node_modules|(r|build|min)\.js)$/

在所有情况下,请注意与开始/结束运算符相关的括号:/^(stuff)$/.

于 2013-10-10T11:12:07.187 回答