using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions;namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string exp = "a001+fy002*de003"; string[] vars = Regex.Matches(exp, @"[a-zA-Z]+\d*").Cast<Match>().Select(x => x.Value).ToArray(); foreach (string item in vars) { Console.WriteLine(item); } } } }a001 fy002 de003 Press any key to continue . . .
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string exp = "a001+fy002*de003";
string[] vars = Regex.Matches(exp, @"[a-zA-Z]+\d*").Cast<Match>().Select(x => x.Value).ToArray();
foreach (string item in vars)
{
Console.WriteLine(item);
}
}
}
}a001
fy002
de003
Press any key to continue . . .