kopia lustrzana https://github.com/micropython/micropython-lib
re-pcre: sub(): If suffix of string matched, None was returned.
rodzic
62240137d4
commit
f1201bdce9
|
@ -0,0 +1,5 @@
|
||||||
|
name = re
|
||||||
|
srctype = micropython-lib
|
||||||
|
type = module
|
||||||
|
version = 0.1.7
|
||||||
|
author = Paul Sokolovsky
|
|
@ -95,6 +95,7 @@ class PCREPattern:
|
||||||
else:
|
else:
|
||||||
res += repl
|
res += repl
|
||||||
s = s[end:]
|
s = s[end:]
|
||||||
|
return res
|
||||||
|
|
||||||
def split(self, s, maxsplit=0):
|
def split(self, s, maxsplit=0):
|
||||||
res = []
|
res = []
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
import sys
|
import sys
|
||||||
# Remove current dir from sys.path, otherwise distutils will peek up our
|
# Remove current dir from sys.path, otherwise setuptools will peek up our
|
||||||
# module instead of system.
|
# module instead of system.
|
||||||
sys.path.pop(0)
|
sys.path.pop(0)
|
||||||
from distutils.core import setup
|
from setuptools import setup
|
||||||
|
|
||||||
|
|
||||||
setup(name='micropython-re-pcre',
|
setup(name='micropython-re-pcre',
|
||||||
version='0.1.6',
|
version='0.1.7',
|
||||||
description='re module for MicroPython, based on PCRE and FFI',
|
description='re-pcre module for MicroPython',
|
||||||
|
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
|
||||||
url='https://github.com/micropython/micropython/issues/405',
|
url='https://github.com/micropython/micropython/issues/405',
|
||||||
author='Paul Sokolovsky',
|
author='Paul Sokolovsky',
|
||||||
author_email='micro-python@googlegroups.com',
|
author_email='micro-python@googlegroups.com',
|
||||||
|
maintainer='MicroPython Developers',
|
||||||
|
maintainer_email='micro-python@googlegroups.com',
|
||||||
license='MIT',
|
license='MIT',
|
||||||
py_modules=['re'])
|
py_modules=['re'])
|
||||||
|
|
|
@ -28,3 +28,5 @@ assert re.split('(\W+)', 'Words, words, words.') == ['Words', ', ', 'words', ',
|
||||||
assert re.split('\W+', 'Words, words, words.', 1) == ['Words', 'words, words.']
|
assert re.split('\W+', 'Words, words, words.', 1) == ['Words', 'words, words.']
|
||||||
assert re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE) == ['0', '3', '9']
|
assert re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE) == ['0', '3', '9']
|
||||||
assert re.split('(\W+)', '...words, words...') == ['', '...', 'words', ', ', 'words', '...', '']
|
assert re.split('(\W+)', '...words, words...') == ['', '...', 'words', ', ', 'words', '...', '']
|
||||||
|
|
||||||
|
assert re.sub(r"[ :/?&]", "_", "http://foo.ua/bar/?a=1&b=baz/") == "http___foo.ua_bar__a=1_b=baz_"
|
||||||
|
|
Ładowanie…
Reference in New Issue