Skip to content

String validation tool compiling into regex

License

Notifications You must be signed in to change notification settings

tesseradecade/vbml

Repository files navigation

— markup language that compiles to regex.

VBML version Python version PyPI - Downloads GitHub issues by-label

Features

  • Clean regex compiler and parser (the regex core can be easily switched)
  • Built-in validators and easy to implement custom ones
"I am <name>, i am <age:int> years old" + "I am Steve, i am 50 years old" = {"name": "Steve", "age": 50}

Installation

Install with pip, poetry or uv:

pip install vbml
poetry add vbml
uv add vbml

📖 Documentation

*here*

Example

from vbml import Patcher, Pattern

patcher = Patcher()
pattern = Pattern("I have <amount:int> apples. They are <adj>")

result1 = patcher.check(pattern, "I have 3 apples. They are green")
result2 = patcher.check(pattern, "I have three apples. They are green")
result3 = patcher.check(pattern, "I have apples")

result1  # {"amount": 3, "adj": "green"}
result2  # None
result3  # False

About

String validation tool compiling into regex

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •  

Languages