楼主:
fantic (什么都会变的...)
2012-02-02 10:31:55/* 听说注明使用的语言、环境
* 问题有可能较容易被解决...
*/
我的资料长得像
<A><B>xxxxx1xxx</B></A><A><B>xxxxx2xxx</B></A><A><B>xxxxx3xxx</B></A>
我的写法(C#)
string input = "<A><B>xxxxx1xxx</B></A><A><B>xxxxx2xxx</B></A><A><B>xxx
xx3xxx</B></A>";
string pattern = @"(<A>.*</A>)"; // 规则字串
Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
MatchCollection matches = regex.Matches(input); // 将比对后集合传给 MatchCollection
可是传回的结果会是一组(原先的资料),我希望可以回传的结果是有三组符合
分别是 <A><B>xxxxx1xxx</B></A>
<A><B>xxxxx2xxx</B></A>
<A><B>xxxxx3xxx</B></A>
尝试改了很久的pattern写法都无法成功~希望大大们帮忙,感谢^^