fork(1) download
  1. using System;
  2. using System.IO;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var s = "1 2 obj\rObj1\rendobj\r2 3 obj\rObj2\rendobj\r3 45 obj\rObj3\rendobj";
  10. var matches = Regex.Matches(s, @"(?<=\r|^)(?<obj>\d+ \d+) obj\r(?<objData>.+?)\rendobj(?=\r|$)",
  11. RegexOptions.Multiline | RegexOptions.Singleline);
  12. foreach (Match m in matches)
  13. {
  14. Console.WriteLine("___ MATCH ___");
  15. Console.WriteLine(m.Value);
  16. }
  17. }
  18. }
Success #stdin #stdout 0.03s 30472KB
stdin
Standard input is empty
stdout
___ MATCH ___
1 2 obj
Obj1
endobj
___ MATCH ___
2 3 obj
Obj2
endobj
___ MATCH ___
3 45 obj
Obj3
endobj