Skip to main content

Tool used to build regex expressions for python

Project description

Rejex

Rejex is a tool used to build regex expressions for python.

A library which can help in building regex expressions which can be used with regex libraries(such as "re") to parse strings.



Changelogs

Changelogs



Usage

import rejex
from rejex import Rejex, Static

rejex_test = (
        Rejex()
            .zero_or_one(
                Rejex()
                    .literal("+")
                    .one_or_more(
                        Static.any_number()
                    )
                    .compile()
            )
            .zero_or_one(Static.literal(" "))
            .zero_or_one(Static.literal("("))
            .n_number_times(3, Static.any_number())
            .zero_or_one(Static.literal(")"))
            .zero_or_one(Static.literal(" "))
            .n_number_times(3, Static.any_number())
            .zero_or_one(Static.alternative(Static.literal("-"), Static.literal(" ")))
            .n_number_times(4, Static.any_number())
        .compile()
    )

rejex.test_regex(rejex_test, "+1 (123) 123 4567") #True
"""
-------------------------------
regex_pattern='(\+(\d)+)? ?(\()?(\d){3}(\))? ?(\d){3}((-| ))?(\d){4}'
string='+1 (123) 123 4567'
match=True
-------------------------------
"""

Uses



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

rejex-0.0.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

rejex-0.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file rejex-0.0.1.tar.gz.

File metadata

  • Download URL: rejex-0.0.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.10.0

File hashes

Hashes for rejex-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f6fc9c656b1f9af0937b3a0798a0cf5a1f3ff4230417453c7a1cd858f0415bd2
MD5 292f49a45d64881a0c0c09b54bcc347f
BLAKE2b-256 398a2d64bef69368a0c65f59a567edbc92a8fd04d35123f0903710f5d6412cd8

See more details on using hashes here.

File details

Details for the file rejex-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: rejex-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.10.0

File hashes

Hashes for rejex-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b72a786ecef33fade35f4e063be262ba8aa943bb278f50bb578a59b28727d8c5
MD5 87730ab25a2811ee98f4d9e0c58afd90
BLAKE2b-256 625345b608638fc006b33eaf0fcbf7d89da167ed88bb90abb82fdcb181c7d8f3

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