package cure2
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha512=6bf553f3c8414bd20335fb449ef0ca7b9211fff7fec1817fe26b2565aa45c5c83aea532d18f4797c07e477e9ec73321c5c7b7f59bfa6bf664ca3103c8f464ad7
Description
No need to remember regexp syntax to use Re2.
README
Cure2
Cure2 is a combinator frontend for Re2. It allows you to use Re2 without having to deal with the syntax.
Instead of [+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)? you can write
opt (chars "+-")
+ ((rep1 digit + opt (char '.' + rep digit)) || (char '.' + rep1 digit))
+ opt (chars "eE" + opt (chars "+-") + rep1 digit)Instead of "https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&//=]*)", you can write:
let second_level_char = charset Charset.[Ascii.alnum; chars "-@:%._\\+~#="] in
let top_level_chars = charset Charset.[Ascii.alnum; chars "()"] in
let path_chars = charset Charset.[Ascii.alnum; chars "()@:%_\\+.~#?&/="] in
str "http" + !?(char 's') + str "://"
+ !?(str "www.") + rep ~min:1 ~max:256 second_level_char
+ char '.' + rep ~min:1 ~max:6 top_level_chars
+ bow + rep path_charsThis is more verbose but also way more readable. And contrary to regexp you just hover on anything you are not familiar with and documentation will show up.
The interface is inspired by the Re library, but there are a few difference in cases where I thought it could be improved or where the semantics had to be different because the backends are not the same.
The main reason to use this over Re is the Unicode support. There are also performance differences, but according to my testing they are minimal.
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building cure2 with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 1.0 (this version) | n/a | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure