Common Lisp implementation of Match Patterns Web standard
- Common Lisp 97%
- Makefile 3%
| .github | ||
| deps | ||
| source | ||
| tests | ||
| .gitignore | ||
| .gitmodules | ||
| cl-match-patterns.asd | ||
| LICENSE | ||
| makefile | ||
| README.org | ||
cl-match-patterns
cl-match-patterns is a library supporting match patterns as seen in major browsers.
Might be useful for lightweight URL matching or interop with web engines like WebKit. Otherwise it’s just a minor nerd snipe for a Web standards freak like me 😉
Getting Started
Clone the Git repository:
git clone --recursive https://codeberg.org/aartaka/cl-match-patterns ~/common-lisp/
And then load :cl-match-patterns in the REPL:
(asdf:load-system :cl-match-patterns)
;; or, if you use Quicklisp
(ql:quickload :cl-match-patterns)
And then use either of the APIs:
(cl-match-patterns:parse "*://*/*")
;; => #<CL-MATCH-PATTERNS:PATTERN {12033506B3}>
(cl-match-patterns:parse "*://")
;; CL-MATCH-PATTERNS:MALFORMED-PATTERN: Cannot parse pattern '*://' because path is mandatory (even if a mere '/')
(cl-match-patterns:match "https://aartaka.me" (cl-match-patterns:parse "*://*/*"))
;; => T, T, T, T
In case you prefer CLI interaction, you can run tests with make check and get a development-ready REPL / Swank / Slynk with make repl / make swank / make slynk.
Examples
See /aartaka/cl-match-patterns/src/branch/main/tests/tests.lisp or match patterns documentation for numerous examples of match patterns.