Something like that should do the work:
List<string> exp = new List<string>();
exp.Add("#:t.Brand");
exp.Add("#:iF(12 > 10,t.price,t.description)");
exp.Add("#:t.Brand + 'and ' + t.SubBrand");
System.Text.RegularExpressions.Regex searchTerm =
new System.Text.RegularExpressions.Regex(@"t.\w+");
var qry = from al in exp
let matches = searchTerm.Matches(al)
where matches.Count>0
select new
{
origText=al,
foundText=from System.Text.RegularExpressions.Match match in matches
select match.Value
};
Note:
foundtext
returns
IEnumerable
. So, you need to loop twice:
foreach(var v in qry)
{
Console.WriteLine("--- {0} ---", v.origText.ToString());
foreach (var t in v.foundText)
{
Console.WriteLine("{0}", t.ToString());
}
}
Result:
--- #:t.Brand ---
t.Brand
--- #:iF(12 > 10,t.price,t.description) ---
t.price
t.description
--- #:t.Brand + 'and ' + t.SubBrand ---
t.Brand
t.SubBrand