需要谷歌索赔的正则表达式帮助

时间:2014-04-15 14:55:29

标签: regex

我需要像这样用

分割一个字符串
"1. This is the claim 1, and blalba. 2. This is the claim number 2, and some other text. 3. And this is sample 3, for test."

这是google pattent的说法。我想将它拆分成字符串列表,如下所示:

1. This is the claim 1, and blala.
2. This is the claim number 2, and some other text.
3. And this is sample 3, for test.

我使用这个正则表达式但没有成功,你能帮助我建立另一个正则表达式:

string pattern = @"^(\d.\s[\w.\s,#-_;:]*.\s\d)$";
string testText = "2. A barrier. 5. Second. 9";
string[] mycolection = Regex.Split(testText, pattern);

由于

1 个答案:

答案 0 :(得分:1)

这样做:

Regex.Split("test",@"\d+\.");

这将返回文本