Regex 正则表达式使用大括号匹配单词和周围的文本
我有这样一个代码:Regex 正则表达式使用大括号匹配单词和周围的文本,regex,notepad++,Regex,Notepad++,我有这样一个代码: 111 { text text text } 222 { text target_word text text can be any number of lines } 333 { text text text } 我试着匹配目标词上下的所有内容,包括大括号和“222”,所以它会匹配这个: 222 { text target_word text text
111
{
text
text
text
}
222
{
text
target_word
text
text
can be any number of lines
}
333
{
text
text
text
}
我试着匹配目标词上下的所有内容,包括大括号和“222”,所以它会匹配这个:
222
{
text
target_word
text
text
}
正则表达式是什么?最好使用记事本++。试试:
\d+\r?\n\{[^\{]*?yourword[^\{]*?\r?\n\}