pcre2 alternatives and similar packages
Based on the "Text" category.
Alternatively, view pcre2 alternatives based on common mentions on social networks and blogs.
-
pandoc-citeproc
Library and executable for using citeproc with pandoc -
scholdoc
Fork of Pandoc for the implementation of a ScholarlyMarkdown parser -
skylighting
A Haskell syntax highlighting library with tokenizers derived from KDE syntax highlighting descriptions -
blaze-from-html
A blazingly fast HTML combinator library for Haskell. -
prettyprinter
A modern, extensible and well-documented prettyprinter. -
commonmark
Pure Haskell commonmark parsing library, designed to be flexible and extensible -
regex-genex
Given a list of regexes, generate all possible strings that matches all of them. -
regex-applicative
Regex-based parsing with an applicative interface -
pandoc-csv2table
A Pandoc filter that renders CSV as Pandoc Markdown Tables. -
servant-checked-exceptions
type-level errors for Servant APIs. -
double-conversion
A fast Haskell library for converting between double precision floating point numbers and text strings. It is implemented as a binding to the V8-derived C++ double-conversion library. -
text-format
A Haskell text formatting library optimized for ease of use and high performance. -
diagrams-pandoc
A pandoc filter to express diagrams inline using the haskell EDSL diagrams. -
boxes
A pretty-printing library for laying out text in two dimensions, using a simple box model.
Build time-series-based applications quickly and at scale.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of pcre2 or a related project?
README
pcre2
Regular expressions for Haskell.
Teasers
embeddedLicensePlate :: Text -> Maybe Text
embeddedLicensePlate = match "[A-Z]{3}[0-9]{3,4}"
case "The quick brown fox" of
[regex|brown\s+(?<animal>\S+)|] -> Text.putStrLn animal
_ -> error "nothing brown"
let kv'd = lined . packed . [_regex|^\s*(.*?)\s*[=:]\s*(.*)|]
forMOf kv'd file $ execStateT $ do
k <- gets $ capture @1
v <- gets $ capture @2
liftIO $ Text.putStrLn $ "found " <> k <> " set to " <> v
case myMap ^. at k of
Just v' | v /= v' -> do
liftIO $ Text.putStrLn $ "setting " <> k <> " to " <> v'
_capture @2 .= v'
_ -> liftIO $ Text.putStrLn "no change"
Features
- Low-surface API covering most use cases.
- Quiet functions with simple types—for the most part it's
Text
(pattern)-> Text
(subject)-> result
. - Use partial application to create performant, compile-once-match-many code.
- Low cognitive overhead—there's just one custom datatype for both compile
and match options, the
Option
monoid. Text
everywhere for interop with both C and the broader Haskell ecosystem.- Match failures expressed via
Alternative
or pattern match failures. - Opt-in Template Haskell facilities for compile-time verification of patterns, indexing captures, and memoizing inline regexes.
- Opt-in
lens
support. - No failure monads to express compile errors, preferring pure functions and
throwing imprecise exceptions with pretty
Show
instances. Write simple code and debug it. Or, don't, and use the Template Haskell features instead. Both are first-class. - Vast presentation of PCRE2 functionality. We can even register Haskell callbacks to run during matching!
- No dependencies that aren't distributed with GHC.
- Bundled, statically-linked UTF-16 build of
up-to-datePCRE2 (version 10.35), with a complete, exposed Haskell binding.
TODO
- Global matching. (We already have global substitution.)
- Many performance optimizations. Currently we are 2–3× slower than other libraries doing everything (a few μs).
- Make use of DFA and JIT compilation.
- Establish automated builds.
- Improve PCRE2 C compile time.
- PCRE2 10.36 is out already.
License
Apache 2.0.
PCRE2 is distributed under the 3-clause BSD license.
Author
©2020 Shlomo Shuck
*Note that all licence references and agreements mentioned in the pcre2 README section above
are relevant to that project's source code only.