diff options
Diffstat (limited to 'tests/extmod/ure1.py')
-rw-r--r-- | tests/extmod/ure1.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/extmod/ure1.py b/tests/extmod/ure1.py index aeadf4e5c5..a867f17515 100644 --- a/tests/extmod/ure1.py +++ b/tests/extmod/ure1.py @@ -1,7 +1,12 @@ try: import ure as re except ImportError: - import re + try: + import re + except ImportError: + import sys + print("SKIP") + sys.exit() r = re.compile(".+") m = r.match("abc") @@ -11,6 +16,10 @@ try: except IndexError: print("IndexError") +# conversion of re and match to string +str(r) +str(m) + r = re.compile("(.+)1") m = r.match("xyz781") print(m.group(0)) @@ -63,6 +72,11 @@ m = re.match('^ab$', 'ab'); print(m.group(0)) m = re.match('a|b', 'b'); print(m.group(0)) m = re.match('a|b|c', 'c'); print(m.group(0)) +# Case where anchors fail to match +r = re.compile("^b|b$") +m = r.search("abc") +print(m) + try: re.compile("*") except: |