I was looking at different answers here but unfortunately none of them was good for my case. So I hope you don't mind about it.
So I need to match everything between two curly brackets {} except situation when match starts with @ and without these curly brackets e.g:
- "This is a super text {match_this}"
- "{match_this}"
- "This is another example @{deal_with_it}"
Here are my test strings, 1,2,3 are valid while the last one shouldn't be:
1 {eww}
2 r23r23{fetwe}
3 #{d2dded}
4 @{d2dded}
I was trying with:
(?<=[^@]\{)[^\}]*(?=\})
Then only 2th and 3th options were matches (without the first one) https://regex101.com/r/qRInUf/2/
Then I was trying:
\{(.*?)\} or [^@]\{(.*?)\}
In both cases I was unable to match 1,2,3 values https://regex101.com/r/uYRtLD/1
Thanks in advance for any suggestions.
EDIT: This is for java.