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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Apr 11, 2014, 6:51 AM EDT
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 AvhadRank #3,587 · 406 reputationPosted Apr 11, 2014, 6:42 AM EDT
Refer,
http://www.dotnetperls.com/split
http://msdn.microsoft.com/en-us/library/ms228388.aspx