using System;
using System.Text .RegularExpressions ;
using System.Collections .Specialized ;
class Program {
static void Main( ) {
string yourstring = @"1.1 - Hello
1.2 - world!
2.1 - Some
data
here and it contains some 32 digits so i cannot use \D+
2.2 - Etc.." ;
var resultList = new StringCollection( ) ;
try {
var yourRegex = new Regex( @"(?sm)^\d+\.\d+\s*-\s*((?:.(?!^\d+\.\d+))*)" ) ;
Match matchResult = yourRegex.Match ( yourstring) ;
while ( matchResult.Success ) {
resultList.Add ( matchResult.Groups [ 1 ] .Value ) ;
Console.WriteLine ( "Whole Match: " + matchResult.Value ) ;
Console.WriteLine ( "Group 1: " + matchResult.Groups [ 1 ] .Value + "\n " ) ;
matchResult = matchResult.NextMatch ( ) ;
}
} catch ( ArgumentException ex) {
// Syntax error in the regular expression
}
Console.WriteLine ( "\n Press Any Key to Exit." ) ;
Console.ReadKey ( ) ;
} // END Main
} // END Program
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnM7CnVzaW5nIFN5c3RlbS5Db2xsZWN0aW9ucy5TcGVjaWFsaXplZDsKY2xhc3MgUHJvZ3JhbSB7CgpzdGF0aWMgdm9pZCBNYWluKCkgewpzdHJpbmcgeW91cnN0cmluZyA9IEAiMS4xIC0gSGVsbG8KMS4yIC0gd29ybGQhCjIuMSAtIFNvbWUKZGF0YQpoZXJlIGFuZCBpdCBjb250YWlucyBzb21lIDMyIGRpZ2l0cyBzbyBpIGNhbm5vdCB1c2UgXEQrCjIuMiAtIEV0Yy4uIjsKdmFyIHJlc3VsdExpc3QgPSBuZXcgU3RyaW5nQ29sbGVjdGlvbigpOwp0cnkgewoJdmFyIHlvdXJSZWdleCA9IG5ldyBSZWdleChAIig/c20pXlxkK1wuXGQrXHMqLVxzKigoPzouKD8hXlxkK1wuXGQrKSkqKSIpOwoJTWF0Y2ggbWF0Y2hSZXN1bHQgPSB5b3VyUmVnZXguTWF0Y2goeW91cnN0cmluZyk7Cgl3aGlsZS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