Skip to main content

Next-gen string pattern DSL & compiler

Project description

STRling for Python (Quick Start)

🗺️ Overview

This is the Python binding for STRling, a next-generation production-grade syntax designed as a user interface for writing powerful regular expressions (RegEx).

STRling makes string validation and matching readable, safe, and consistent across environments. Instead of cryptic regex syntax, you build patterns using a clean, object-oriented DSL. Under the hood, STRling compiles to native RegEx engines — but adds instructional error handling and consistent semantics.

🗝️ Key Features

  • Beginner Friendly: No regex jargon required.
  • Reliable: Built only on standard libraries.
  • Instructional Errors: Explains what went wrong and how to fix it.
  • Consistent: Works across frameworks and libraries without custom validators.
  • Multilingual: Available across popular programming languages (JavaScript, and more coming soon).

💾 Installation

Install STRling via pip:

pip install STRling

✨ STRling in action!

Basic Example: US Phone Number

from STRling import simply as s
import re

# Define parts of a US phone number pattern
separator = s.in_chars(" -")
area_code = s.merge(
    s.may("("),
    s.group("area_code", s.digit(3)),
    s.may(")")
)
central_part = s.group("central_part", s.digit(3))
last_part = s.group("last_part", s.digit(4))

phone_number_pattern = s.merge(
    area_code,
    s.may(separator),
    central_part,
    s.may(separator),
    last_part
)

# Compile to RegEx
example_text = "(123) 456-7890 and 123-456-7890"
pattern = re.compile(str(phone_number_pattern))
matches = pattern.finditer(example_text)

for match in matches:
    print("Full Match:", match.group())
    print("Area Code:", match.group("area_code"))
    print("Central Part:", match.group("central_part"))
    print("Last Part:", match.group("last_part"))

📚 Complete API Documentation

For comprehensive syntax reference and all available features, see the Python API Reference.

📖 Related Documentation

💖 Support

If you find STRling useful, consider buying me a coffee.

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

strling-2.5.9.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

strling-2.5.9-py3-none-any.whl (38.2 kB view details)

Uploaded Python 3

File details

Details for the file strling-2.5.9.tar.gz.

File metadata

  • Download URL: strling-2.5.9.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for strling-2.5.9.tar.gz
Algorithm Hash digest
SHA256 784c43b2ede05ac6216ae43bf3b4e210136bad064ae5ae08986dfe1e562923a4
MD5 636b9c3c26972878dfada4df46888bac
BLAKE2b-256 123c357b658ded42846359c4493c437b1e1f6a35a5baca35d47ae522c34f4754

See more details on using hashes here.

Provenance

The following attestation bundles were made for strling-2.5.9.tar.gz:

Publisher: ci.yml on TheCyberLocal/STRling

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file strling-2.5.9-py3-none-any.whl.

File metadata

  • Download URL: strling-2.5.9-py3-none-any.whl
  • Upload date:
  • Size: 38.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for strling-2.5.9-py3-none-any.whl
Algorithm Hash digest
SHA256 73d031a86953ca7cdf143425b0c15f4003c3e78e83eb17c47577809cb8905918
MD5 d6654eacea3a1961fcf2e35af68a6404
BLAKE2b-256 6a86709def1e17fe46b559d8fd5ba1f5d9cceaef073a2bbf84694c358d1a044b

See more details on using hashes here.

Provenance

The following attestation bundles were made for strling-2.5.9-py3-none-any.whl:

Publisher: ci.yml on TheCyberLocal/STRling

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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