Regex 要匹配模式的正则表达式

Regex 要匹配模式的正则表达式,regex,Regex,我正试图找出一个与模式匹配的正则表达式 } { one or more lines here } 一,;e一个卷曲的右大括号,后跟零行或多行空行,后跟一个卷曲的左大括号,后跟零行或多行文本,后跟一个卷曲的右括号 我尝试了以下方法: /}\s*{.\n*}/ 并作出以下解释: } - matches the character } literally \s* zero or more character [\r\n\t\f ] { matches the character { litera

我正试图找出一个与模式匹配的正则表达式

}

{
one or more lines here
}
一,;e一个卷曲的右大括号,后跟零行或多行空行,后跟一个卷曲的左大括号,后跟零行或多行文本,后跟一个卷曲的右括号

我尝试了以下方法:

/}\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
然而,这并不匹配

请指出我在这方面做错了什么

}\s*{[^}]*}
试试这个。看演示

你的正则表达式

{.\n*}

有效地量化
\n
而不是
。因此它匹配
一个字符和任意数量的\n