using System;
using System.Text.RegularExpressions;
string str = "(name='abc') and (id>123) or (memo like '%(v)%')";
Regex re = new Regex(@"\s*((\w+\s*)?\([^\(\)]+(\([^\)]*\))*[^\)]*\))");
MatchCollection mc = re.Matches(str);
for (int i=0; i < mc.Count; i++)
{
Console.WriteLine("{0}:***{1}***",i, mc[i].Result("$1"));
}