Reputation: 410
I am trying to split the string using Regex and struck with a problem. Can someone help here
I have a string "The Quick <B> Brown fox <AB> Jumped on <Z>"
I want to return only B, AB, Z as strings.
Regex regex = new Regex(@"<(.*)>");
foreach (Match match in regex.Matches(strMessage))
{
MessageBox.Show(match.Value.ToString());
}
but this returns only one message with
<B> Brown fox <AB> Jumped on <Z>
Upvotes: 0
Views: 30
Reputation: 502
use from this regex instead of.
Regex regex = new Regex(@"[<](\w*)[>]");
foreach (Match match in regex.Matches(strMessage))
{
MessageBox.Show(match.Value.ToString());
}
Upvotes: 1