fork(2) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var regex = new Regex(@"(?=(?:^.{10,}$|(?<issmall>^.{6,9}$)))(?(issmall)(?=^.*\d)(?=^.*[a-zA-Z]).*|.*)", RegexOptions.Compiled);
  9.  
  10. Console.WriteLine("0123456789: " + regex.IsMatch("0123456789"));
  11. Console.WriteLine("Hello1: " + regex.IsMatch("Hello1"));
  12. Console.WriteLine("Helloa: " + regex.IsMatch("Helloa"));
  13. Console.WriteLine("123456: " + regex.IsMatch("123456"));
  14. Console.WriteLine("Thats a very long text that should be accepted.: " + regex.IsMatch("Thats a very long text that should be accepted."));
  15. }
  16. }
Success #stdin #stdout 0.03s 30656KB
stdin
Standard input is empty
stdout
0123456789: True
Hello1: True
Helloa: False
123456: False
Thats a very long text that should be accepted.: True