1

我正在寻找一些测试被评论的文件列表

//     beforeEach(async(() => {
//   beforeEach(async(() => {
 //     beforeEach(async(() => {
//    beforeEach(async(() => {

来自https://regex101.com/

\/\/( ){0,}beforeEach\(async\(\(\) => \{$

工作正常,......但在我得到的终端内

git grep "\/\/( ){0,}beforeEach\(async\(\(\) => \{$"
fatal: command line, '\/\/( ){0,}beforeEach\(async\(\(\) => \{$': Unmatched \{
4

1 回答 1

1

您需要确保该模式符合 POSIX BRE 标准。

利用

git grep "// *beforeEach(async(() => {$"

也就是说,(在 POSIX BRE 表达式中匹配文字({匹配文字{

当您转义左大括号时\{,它会启动一个范围量词,因此\}是预期的,因此是错误,Unmatched \{

于 2020-04-30T20:19:44.833 回答