fork(14) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8.  
  9.  
  10. String s = @"abcde my first line
  11. fghij my second line
  12. klmno my third line";
  13.  
  14. String mySubstring = "fghij";
  15.  
  16. Match m = Regex.Match(s, "^" + mySubstring + ".*", RegexOptions.Multiline);
  17.  
  18. if (m.Success) {
  19. Console.WriteLine(m.Value);
  20. }
  21.  
  22.  
  23. }
  24. }
Success #stdin #stdout 0.11s 24560KB
stdin
Standard input is empty
stdout
fghij   my second line