micropython/tests/extmod/ure_split.py
Damien George 07615d9f7e tests/extmod: Move split-on-empty-match tests to a separate test file.
And provide an expected-output file because these tests have a different
behaviour under CPython.
2016-04-26 10:19:04 +01:00

25 lines
372 B
Python

try:
import ure as re
except ImportError:
import re
r = re.compile(" ")
s = r.split("a b c foobar")
print(s)
r = re.compile(" +")
s = r.split("a b c foobar")
print(s)
r = re.compile(" +")
s = r.split("a b c foobar", 1)
print(s)
r = re.compile(" +")
s = r.split("a b c foobar", 2)
print(s)
r = re.compile("[a-f]+")
s = r.split("0a3b9")
print(s)