fork 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 input = @"textextextext
  11. <%
  12. this is javascript code
  13. %>
  14. textextextextextextextext";
  15.  
  16. Regex rgx = new Regex(@"(?s)<%.*?%>");
  17.  
  18. foreach (Match m in rgx.Matches(input))
  19. {
  20. Console.WriteLine(m.Groups[0].Value);
  21. }
  22. }
  23. }
Success #stdin #stdout 0.07s 34760KB
stdin
Standard input is empty
stdout
<%
this is javascript code
%>