I am trying to parse a string and get all the words enclosed between braces {} that have '!' in him. Input Example:
"This is {matchA} and {matchB} but I need {matchC!matchD}, however {matchE} doesn't count but {matchF!matchG} is what I'm looking for"
I used (?<=\{)(.*?)(?=\}) And {(?:\.|(\\{)|[^}'\n])*} to get all matches between {} , but as a match, it returns the following:
"matchA" , "matchB" , "matchC!matchD" , "matchE" and "matchF!matchG" as matches
However, I try to get only matches that have a "!" in them the result should be only: "matchC!matchD" and "matchF!matchG" and ignore the rest.
I am very grateful for the help. Thank you all for your answers.
source share