2014-09-14 18:14:28 -04:00
|
|
|
try:
|
|
|
|
import ure as re
|
|
|
|
except ImportError:
|
2017-02-14 17:56:22 -05:00
|
|
|
try:
|
|
|
|
import re
|
|
|
|
except ImportError:
|
|
|
|
print("SKIP")
|
2017-06-10 13:14:16 -04:00
|
|
|
raise SystemExit
|
2014-09-14 18:14:28 -04:00
|
|
|
|
|
|
|
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")
|
2015-02-21 05:39:41 -05:00
|
|
|
print(s)
|
2017-06-30 18:25:23 -04:00
|
|
|
|
|
|
|
# bytes objects
|
|
|
|
r = re.compile(b"x")
|
|
|
|
s = r.split(b"fooxbar")
|
|
|
|
print(s)
|