Skip to main content

combine re compile

Project description

任意组合 re.compile

PyPI version License: MIT

兼容环境

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

combine_re_compile-0.0.3.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

combine_re_compile-0.0.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file combine_re_compile-0.0.3.tar.gz.

File metadata

  • Download URL: combine_re_compile-0.0.3.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for combine_re_compile-0.0.3.tar.gz
Algorithm Hash digest
SHA256 273f1f925d527446b2ab6cc0f80b1971c04b4cdefac13c77bdb1d5aa74d9f85b
MD5 5d037de93f0210026ef55cbea5f1bd86
BLAKE2b-256 f3732df18245fbfad1aed425cd12d54d04ea4df22d7e2b83ad43cb4fb5f743ea

See more details on using hashes here.

File details

Details for the file combine_re_compile-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: combine_re_compile-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for combine_re_compile-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 89b017b5e3bd9d3ac7ecaea0e6d86d6e85076be8a011bcc6834e696215825edb
MD5 987827da239fff9a08c44c7215b7cf64
BLAKE2b-256 af0ace5c5c9f8a9692746712b62d818f0bf4d0561edd43b28a3464f20351fc97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page