任意组合 re.compile
兼容环境
Windows/Linux/MacOs
1 安装
pip 安装
$ pip install combine_re_compile
源码安装
$ git clone https://github.com/landybird/combine_re_compile.git
$ cd combine_re_compile
$ python setup.py install
2 使用
DIGIT_PATTERN = re.compile(r"""
(?P<my_digit_pattern> # start named group
\d+ # 1 or more integers
) # close named group
""", re.VERBOSE)
CHAR_PATTERN = re.compile(r"""
(?P<my_char_pattern> # start named group
[a-z] # a character
) # close named group
""", re.VERBOSE)
CHARS_PATTERN = re.compile(r"""
(?P<my_char_pattern> # start named group
[a-z]+ # a character
) # close named group
""", re.VERBOSE)
r = CombinationPattern(DIGIT_PATTERN, CHAR_PATTERN, new_pattren_name="my_new_pattern").get_new_pattern
s = "213213as2312"
print(r.search(s).group('my_new_pattern')) # 分组名称
>> 213213a
License
MIT ©landybird
Release files for combine-re-compile 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| combine_re_compile-0.0.3.tar.gz | 2.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| combine_re_compile-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / combine_re_compile-0.0.3.tar.gz
| Download URL | combine_re_compile-0.0.3.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
273f1f925d527446b2ab6cc0f80b1971c04b4cdefac13c77bdb1d5aa74d9f85b
|
|
BLAKE2b-256 checksum How to use checksums |
f3732df18245fbfad1aed425cd12d54d04ea4df22d7e2b83ad43cb4fb5f743ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
|
Release files / combine_re_compile-0.0.3-py3-none-any.whl
| Download URL | combine_re_compile-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89b017b5e3bd9d3ac7ecaea0e6d86d6e85076be8a011bcc6834e696215825edb
|
|
BLAKE2b-256 checksum How to use checksums |
af0ace5c5c9f8a9692746712b62d818f0bf4d0561edd43b28a3464f20351fc97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
|