Skip to main content

Democritus functions for working with regexes in Python.

Project description

Democritus Regexes

PyPI CI Lint codecov The Democritus Project uses semver version 2.0.0 The Democritus Project uses black to format code License: LGPL v3

Democritus functions[1] for working with and using regexes.

[1] Democritus functions are simple, effective, modular, well-tested, and well-documented Python functions.

We use d8s as an abbreviation for democritus (you can read more about this here).

Functions

  • def is_regex(possible_regex: str) -> bool:
        """Determine whether or not the possible_regex is a valid regex."""
    
  • def regex_closest_match(regex: str, string: str) -> str:
        """Find the longest version of regex that matches something in string."""
    
  • def regex_simplify(regex: str, *, consolidation_threshold: int = 5) -> str:
        """Clean and simplify a regex to a more efficient form."""
    
  • def regex_create(inputs: List[str], *, simplify_regex: bool = True, consolidation_threshold: int = 5) -> str:
        """Create a regex that matches all of the inputs."""
    

Development

👋  If you want to get involved in this project, we have some short, helpful guides below:

If you have any questions or there is anything we did not cover, please raise an issue and we'll be happy to help.

Credits

This package was created with Cookiecutter and Floyd Hightower's Python project template.

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

d8s_regexes-0.4.3.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

d8s_regexes-0.4.3-py2.py3-none-any.whl (20.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file d8s_regexes-0.4.3.tar.gz.

File metadata

  • Download URL: d8s_regexes-0.4.3.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for d8s_regexes-0.4.3.tar.gz
Algorithm Hash digest
SHA256 bde18537078344cbf7cc051c3d12115227feefdbc6c6b99591928d5300e3ee67
MD5 f5ff1ac4f21c786b6c51db0729f66749
BLAKE2b-256 21bd034a2e9336ca5e6002b4fd54fdc8fa2f2f881486fcdebcc34db3d546f912

See more details on using hashes here.

File details

Details for the file d8s_regexes-0.4.3-py2.py3-none-any.whl.

File metadata

  • Download URL: d8s_regexes-0.4.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for d8s_regexes-0.4.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 276dd0332908922e13b0a4e30d167b26c11ca663e16aa7bb66026d213a277590
MD5 763270d41a85880090b0e8f50eddd96e
BLAKE2b-256 ad833a74eb149f261288665b9718a422446a77192d27a962bad760b59c9f872e

See more details on using hashes here.

Supported by

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