1# test named char classes
2
3try:
4    import ure as re
5except ImportError:
6    try:
7        import re
8    except ImportError:
9        print("SKIP")
10        raise SystemExit
11
12
13def print_groups(match):
14    print("----")
15    try:
16        i = 0
17        while True:
18            print(m.group(i))
19            i += 1
20    except IndexError:
21        pass
22
23
24m = re.match(r"\w+", "1234hello567 abc")
25print_groups(m)
26
27m = re.match(r"(\w+)\s+(\w+)", "ABC \t1234hello567 abc")
28print_groups(m)
29
30m = re.match(r"(\S+)\s+(\D+)", "ABC \thello abc567 abc")
31print_groups(m)
32
33m = re.match(r"(([0-9]*)([a-z]*)\d*)", "1234hello567")
34print_groups(m)
35