日期:2014-05-19  浏览次数:21017 次

正则组求解
字符串:我爱1234(888)你爱1522他爱


A   =我爱1234
B   =888
C=1522

------解决方案--------------------
try

string A = " ";
string B = " ";
string D = " ";
string E = " ";
Match m = Regex.Match(yourStr, @ "^(? <group1> [^(]*)((? <group2> [^)]*))你爱(? <group3> \d+\.\d{4})(? <group4> \d*)他爱 ");
if (m.Success)
{
A = m.Groups[ "group1 "].Value;
B = m.Groups[ "group2 "].Value;
D = m.Groups[ "group3 "].Value;
E = m.Groups[ "group4 "].Value;
}

如果类似于前面的C也要,D和E拼接一下就是了