Hello All,
I want to break the below string:
string str ="((G011, G012))";
Output:
G011
G012
Thanks in Advance
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 11, 2014, 10:51 AM
using System;
using System.Text.RegularExpressions;
class Test
{
static void Main()
{
string str ="((G011, G012))";
MatchCollection mc = Regex.Matches(str, @"\w+");
foreach(Match m in mc) Console.WriteLine(m.Value);
Console.ReadKey();
}
}
The output is:
G011
G012
Nilesh AvhadPosted Apr 11, 2014, 10:42 AM
Refer,
http://www.dotnetperls.com/split
http://msdn.microsoft.com/en-us/library/ms228388.aspx