I have a string "Hello [World] This is a {test}" I want to remove all the text in braces , Like "Hello this one" is returning but only if braces match.
Does anyone have a good clean solution?
You can use a regular expression:
s = Regex.Replace (s, @ "\ s *? (?: \ (. *? \) | \ [. *? \] | \. *? \})," String.Empty "; matches any white spot before the bracket. (? :)
to group the conditions inside a non-mailing bracket.
\ (. *? \)
Mathematics is mathematics with zero or more characters between them.
Comments
Post a Comment