我试图找出一个与模式相匹配的正则表达式
}
{
one or more lines here
}
我是一个卷曲的右大括号,后跟零个或多个空行,后跟一个卷曲的开括号,后面是任意一行的零行或多行,后面是一个曲线的右括号。
我尝试了以下内容:
/}\s*{.\n*}/
以下解释:
} - matches the character } literally
\s* zero or more character [\r\n\t\f ]
{ matches the character { literally
. matches any character (except newline)
\n* matches 0 or more line-feed (newline)
} matches the character } literally
然而这并不匹配。
请指出我做错了什么?
答案 0 :(得分:1)
}\s*{[^}]*}
试试这个。看看演示。
https://regex101.com/r/eS7gD7/29
你的正则表达式
{\ N *}
有效量化\n
而非.
。因此它与a character and any number of \n's
匹配。