summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/ure_group.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extmod/ure_group.py')
-rw-r--r--tests/extmod/ure_group.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/extmod/ure_group.py b/tests/extmod/ure_group.py
index e402ce5759..8078a0a855 100644
--- a/tests/extmod/ure_group.py
+++ b/tests/extmod/ure_group.py
@@ -10,7 +10,7 @@ def print_groups(match):
try:
i = 0
while True:
- print(m.group(i))
+ print(match.group(i))
i += 1
except IndexError:
pass
@@ -20,3 +20,9 @@ print_groups(m)
m = re.match(r'([0-9]*)(([a-z]*)([0-9]*))','1234hello567')
print_groups(m)
+
+# optional group that matches
+print_groups(re.match(r'(a)?b(c)', 'abc'))
+
+# optional group that doesn't match
+print_groups(re.match(r'(a)?b(c)', 'bc'))