Reputation: 9521
I am trying to figure a regex that matches the pattern
}
{
one or more lines here
}
i;e a curly closing brace followed by zero or more empty lines followed by a curly opening brace followed by zero or more lines of any text followed by a curly closing bracket.
I tried the following :
/}\s*{.\n*}/
with the following explanation:
} - 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
This however does not match.
Please point out what am I doing wrong with this ?
Upvotes: 1
Views: 30
Reputation: 67968
}\s*{[^}]*}
Try this.See demo.
https://regex101.com/r/eS7gD7/29
Your regex
{.\n*}
effectively quantifies \n
instead of .
.So it matches a character and any number of \n's
.
Upvotes: 1