Take a snippet from a string

0

I want to get the word "[email protected]" inside this MetroMessageBox

I tried this, but it did not work:

String[] palavra = ex.Message.Split(new String[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries);

    
asked by anonymous 10.12.2015 / 12:57

1 answer

0

There is no mystery, just capture the text inside the parentheses.

With regex

var s = Regex.Match(ex.Message, @"\(([^)]*)\)").Groups[1].Value;

No regex

string output = ex.Message.Split('(', ')')[1];

See it working in .NET Fiddle

    
10.12.2015 / 13:17