Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.82 KB

File metadata and controls

54 lines (39 loc) · 1.82 KB

— 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