fork(3) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string text = @"N:
  9. TEL:+65123345
  10. END:VCARD
  11. BEGIN:VENV
  12. BEGIN:VBODY
  13. Date:8/11/2013 11:59:00 PM
  14. thi is a test message
  15. Hello this is a test message on line 2
  16. END:VBODY
  17. END:VENV
  18. END:VENV
  19. END:VMSG";
  20.  
  21. int startindex = text.IndexOf("BEGIN:VBODY") + ("BEGIN:VBODY").Length;//The just start index of Date...
  22. int length = text.IndexOf("END:VBODY") - startindex;//Length of text till END...
  23. if (startindex >= 0 && length >= 1)
  24. {
  25. string value = text.Substring(startindex, length);//This is the text you need.
  26. Console.WriteLine(value);
  27. }
  28. else
  29. {
  30. Console.WriteLine("No match found.");
  31. }
  32. }
  33. }
Success #stdin #stdout 0.04s 33888KB
stdin
Standard input is empty
stdout
            Date:8/11/2013 11:59:00 PM
            thi is a test message
            Hello this is a test message on line 2