日期:2014-05-17 浏览次数:20976 次
Regex testXpress = new Regex(
@"^\s*(?:" +
@"(?:" +
@"(?:(?<low_bound>\d+(?:\.\d+)?))" +
@"\s*(?:-|~)\s*" +
@"(?:(?<high_bound>\d+(?:\.\d+)?))" +
")" +//0.78 - 1.23; 1-2.24; 4.3 -6; 5-9
@"|(?:(?:≤|(?:<=))\s*(?<high_bound>\d+(?:\.\d+)?))" + //<= 1.23; ≤1.12; <=1; ≤ 2
@"|(?:(?:≥|(?:>=))\s*(?<low_bound>\d+(?:\.\d+)?))" + //>= 1.23; ≥1.12; >=1; ≥ 2
@"|(?:(?:<|<)\s*(?<high_bound>\d+(?:\.\d+)?))" + //< 1.23; <1.12; <1; < 2
@"|(?:(?:>|>)\s*(?<low_bound>\d+(?:\.\d+)?))" + //> 1.23; >1.12; >1; > 2
@"|(?<accurate>\d+(?:\.\d+)?)" + // 12.45; 36
@")\s*$"
);
Match mc = testXpress.Match(textBox1.Text);