summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRadomir Dopieralski <openstack@sheep.art.pl>2017-07-25 01:09:47 +0200
committerNoralf Trønnes <noralf@tronnes.org>2019-02-14 15:42:25 +0100
commit20a787adb4140002acb8e5ea21536069e184ffaf (patch)
tree111dbf757ef46fb61d73b05217397607e702844a /tests
parentb9dc23c070bde772a941f803d8fac9cafc0e163c (diff)
extmod/ure: Handle some escape sequences.
Fix MicroPython #3176 Handle escape sequences inside regular expressions. This adds handling for \a, \b, \f, \n, \r, \v and \\.
Diffstat (limited to 'tests')
-rw-r--r--tests/extmod/ure1.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/extmod/ure1.py b/tests/extmod/ure1.py
index 54471ed4f..710720c8b 100644
--- a/tests/extmod/ure1.py
+++ b/tests/extmod/ure1.py
@@ -28,6 +28,19 @@ try:
except IndexError:
print("IndexError")
+r = re.compile(r"\n")
+m = r.match("\n")
+print(m.group(0))
+m = r.match("\\")
+print(m)
+r = re.compile(r"[\n-\r]")
+m = r.match("\n")
+print(m.group(0))
+r = re.compile(r"[\]]")
+m = r.match("]")
+print(m.group(0))
+print("===")
+
r = re.compile("[a-cu-z]")
m = r.match("a")
print(m.group(0))