An implementation of what OriginalGriff said, but with bit changed pattern:
string s = @"Employee Name:john,age:45,salary:$1,000.45,Employee Name:joshua,age:38,salary:$1,200.88,Employee Name:johnattan,age:29,salary:$1,050.23";
string pattern = @"(Employee Name:\w*|age:\d+|salary:\$\b\d+\,\d{3}\.\d{0,2}\b)+";
System.Text.RegularExpressions.Regex searchTerm =
new System.Text.RegularExpressions.Regex(pattern);
var data = Regex.Matches(s,pattern, RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant)
.Cast<System.Text.RegularExpressions.Match>()
.Select(m => new
{
Property = m.Value.Split(':')[0],
Value = m.Value.Split(':')[1]
});
Console.WriteLine("{0}\t\t{1}", "Property", "Value");
foreach(var d in data)
{
Console.WriteLine("{0}\t\t{1}", d.Property, d.Value);
}
Result:
Property Value
Employee Name john
age 45
salary $1,000.45
Employee Name joshua
age 38
salary $1,200.88
Employee Name johnattan
age 29
salary $1,050.23