I have a string that looks like this:
string aa = "First Example (first to delete) , Second example ( Second to delete ) , Thrird Example ( Third to delete )"
From this string I want to delete everything that is inside ( SOME INPUT ) with ( and ).
Problem is that I dont know what this SOME INPUT is. I only know that it is inside ().
https://dotnetfiddle.net/Jnhszs
using System;
using System.Text.RegularExpressions;
public class Program
{
public static void Main()
{
var text = "First Example (first to delete) , Second example ( Second to delete ) , Thrird Example ( Third to delete )";
text = Regex.Replace(text, @"\([^)]*\)", "");
text = Regex.Replace(text, @"\s{2,}", " ");
Console.WriteLine(text);
}
}
Output: First Example , Second example , Thrird Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With