fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string input = "myconst var_name = 20;";
  9. Match match = Regex.Match(input,
  10. @"const\s[^;=]*(\]|\s|\*)*var_name(\(|\[|=|\s|;)",
  11. RegexOptions.IgnoreCase);
  12. if (match.Success)
  13. {
  14. Console.WriteLine("Yes, it is const");
  15. }
  16. }
  17. }
Success #stdin #stdout 0.08s 37232KB
stdin
Standard input is empty
stdout
Yes, it is const