-4

Eg: sdadjaskdhas ^{sdassad ^{/frac{}{} s dcds &} dsdsadsa} ddsfsafdsfs

Answer should be: {sdassad ^{/frac{}{} s dcds &} dsdsadsa}

it should include any character between brackets

1 Answers1

0

Use backspace to escape the ^,{,} characters as they belong to regex. .* to select any number of any characters.

Here is your answer: \^\{.*\}

EDIT: You can use this regex [^\^]\^{(\S)} , print the match, trim the string. Loop over this you find all matches in a string.