re-pcre: sub(): If suffix of string matched, None was returned.

pull/118/head^2
Paul Sokolovsky 2014-06-07 05:01:31 +03:00
rodzic 62240137d4
commit f1201bdce9
4 zmienionych plików z 16 dodań i 4 usunięć

Wyświetl plik

@ -0,0 +1,5 @@
name = re
srctype = micropython-lib
type = module
version = 0.1.7
author = Paul Sokolovsky

Wyświetl plik

@ -95,6 +95,7 @@ class PCREPattern:
else:
res += repl
s = s[end:]
return res
def split(self, s, maxsplit=0):
res = []

Wyświetl plik

@ -1,14 +1,18 @@
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.
sys.path.pop(0)
from distutils.core import setup
from setuptools import setup
setup(name='micropython-re-pcre',
version='0.1.6',
description='re module for MicroPython, based on PCRE and FFI',
version='0.1.7',
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',
author='Paul Sokolovsky',
author_email='micro-python@googlegroups.com',
maintainer='MicroPython Developers',
maintainer_email='micro-python@googlegroups.com',
license='MIT',
py_modules=['re'])

Wyświetl plik

@ -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('[a-f]+', '0a3B9', flags=re.IGNORECASE) == ['0', '3', '9']
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_"