fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. string s = Console.ReadLine();
  8. Regex re = new Regex(s);
  9. while ((s = Console.ReadLine())!=null) {
  10. Match match = re.Match(s);
  11. Console.WriteLine("{0} len = {1} is matched: {2} group1={3} group1.len={4}",
  12. s, s.Length, match.Success, match.Groups[1].Value, match.Groups[1].Value.Length);
  13. }
  14. }
  15. }
Success #stdin #stdout 0.08s 34264KB
stdin
^\s*([^\s]{2,7})\s*$
z
ż
ź
az
aż
dół
dol
kolegów
koliber
korkociąg
traktorem
stdout
z len = 1 is matched: False group1= group1.len=0
ż len = 1 is matched: False group1= group1.len=0
ź len = 1 is matched: False group1= group1.len=0
az len = 2 is matched: True group1=az group1.len=2
aż len = 2 is matched: True group1=aż group1.len=2
dół len = 3 is matched: True group1=dół group1.len=3
dol len = 3 is matched: True group1=dol group1.len=3
kolegów len = 7 is matched: True group1=kolegów group1.len=7
koliber len = 7 is matched: True group1=koliber group1.len=7
korkociąg len = 9 is matched: False group1= group1.len=0
traktorem len = 9 is matched: False group1= group1.len=0