读书人

正则表达式:quot;lt;100 or gt;50 or lt;1000quot;

发布时间: 2012-03-31 13:13:26 作者: rapoo

正则表达式:"<100 or >50 or <1000" 怎么写才能提取的各个or前面的数据,我用".*or"的话会把第二个or之前的字符串全部取出的。求教!
如题求教!

[解决办法]
(?i).*?or
[解决办法]
try...


C# code
            string test = " <100 or >50 or <1000";            Regex reg = new Regex(@"(?isn)(?<c>((?!or).)+)(or|$)");            MatchCollection mc = reg.Matches(test);            foreach (Match m in mc)            {                richTextBox2.Text += m.Groups["c"].Value + "\n";            } 

读书人网 >C#

热点推荐