[英]Regex find find files containing multiple controllers/directives in angular files
So this is working on regexr.com angular.module[\\S\\s]+?\\.(controller|directive)[\\S\\s]+?\\.(controller|directive)
因此,这正在regexr.com
angular.module[\\S\\s]+?\\.(controller|directive)[\\S\\s]+?\\.(controller|directive)
Unfortunately, in vscode file search, it seems to ignore the second part of the controller|directive match and returns any file with at least one .(controller|directive)
不幸的是,在vscode文件搜索中,似乎忽略了指令匹配的第二部分,并返回了至少包含一个的任何文件
.(controller|directive)
What am I doing wrong here? 我在这里做错了什么? I expect using the above regex in global file search to return files that have multiple directives/components in the same file like the below example.
我希望在全局文件搜索中使用上述正则表达式来返回在同一文件中具有多个指令/组件的文件,如以下示例所示。
angular.module( 'myModule' )
.directive( 'myDirective',
[ function ( ) { ... } ])
.controller('myComponent',
[ function ( ) { ... } ]);
However, I'm getting all files back with only one like this. 但是,我只用一个这样的文件就可以找回所有文件。
angular.module( 'myModule' )
.directive( 'myDirective',
[ function ( ) { ... } ]);
VS Code doesn't support multiline search, so it will just test that regex on each line. VS Code不支持多行搜索,因此它将仅在每行上测试该正则表达式。 I actually just added a note about this to our docs: https://github.com/Microsoft/vscode-docs/commit/44cf2ee27a8ce164b61c9c096359506cb1a8809b
我实际上只是在我们的文档中添加了关于此的注释: https : //github.com/Microsoft/vscode-docs/commit/44cf2ee27a8ce164b61c9c096359506cb1a8809b
If the file is open, it will actually pull the matches from the editor, which does support multiline search. 如果文件已打开,它将实际上从编辑器中提取匹配项,该编辑器确实支持多行搜索。 (Just a note in case you see it work sometimes).
(只是注意,以防您有时看到它起作用)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.