fork 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. string NewTextValue = "str";
  10. int characterLimit = 5;
  11. string regxForAlpha = "^[a-zA-Z \n]{0,"+characterLimit.ToString()+"}$";
  12. if(!string.IsNullOrEmpty(NewTextValue))
  13. if (!Regex.IsMatch( NewTextValue, regxForAlpha)){
  14. Console.WriteLine("No match");
  15. }
  16. else
  17. {
  18. Console.WriteLine("Match");
  19. }
  20. }
  21. }
Success #stdin #stdout 0.12s 24640KB
stdin
Standard input is empty
stdout
Match