I have a string
string s = Hello, (L05-#301ME) I am a programmer.
I need to extract this to
string result = Hello, I am a programmer
That mean I need to get all text ouside the parentheses. How can I use RegEx to do this task
I have a string
string s = Hello, (L05-#301ME) I am a programmer.
I need to extract this to
string result = Hello, I am a programmer
That mean I need to get all text ouside the parentheses. How can I use RegEx to do this task
This should work for you:
var input = "Hello, (L05-#301ME) I am a programmer.";
var output = Regex.Replace(input, @" ?\(.*?\)", string.Empty);
Console.WriteLine(output);
// output would be "Hello, I am a programmer."