让我说我有以下文字,我想提取"数字开头"和"数字结束"之间的文字有动态的线条数量和唯一的数字变化,例如:第一,第二等我将从中提取数据的每个文件在"数字开头"和"数字结束"之间有不同的行数.如何编写正则表达式以匹配"数字开头"和"数字结束"之间的内容,而不知道数字起点和"结束数字"之间的文件中有多少行?
问候!
This is the first line This is the second line
Start of numbers
This is the first line
This is the second line
This is the third line
This is the ...... line
This is the ninth line
End of numbers
Run Code Online (Sandbox Code Playgroud)
Pau*_*ver 30
您应该使用SingleLine
告诉您的C#正则表达式.
匹配任何字符的模式(除了之外的任何字符\n
).
var regex = new Regex("Start of numbers(.*)End of numbers",
RegexOptions.IgnoreCase | RegexOptions.Singleline);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
20956 次 |
最近记录: |