optics-regexp: A lensy/optical interface to regular expressions
This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.
This package, in combination with the
optics
package, allows you
to do regular-expression style string manipulations in a lensy manner. We
provide support for the common string types String
and Text
, as well as
for the common binary type ByteString
(which works by assuming utf-8
encoded ByteString
s).
It is probably easiest to explain with some quick examples.
To search for all occurrences of a pattern, we can write
"foo :: a ~ b => Bar a b" ^.. [regex|\w+|] % match
which will yield["foo", "a", "b", "Bar", "a", "b"]
To upper-case the first group in every match of a pattern, we can do
"a: yes, b: no" & [regex|(\w+): (\w+)|] % group 0 %~ toUpper
(the indexing of the groups here starts at 0) which returns"A: yes, B: no"
.
This library is inspired by and based on the
lens-regex-pcre
library, which does the same thing but for
lens
rather than for
optics
.
[Skip to Readme]
Properties
Versions | 0.1.0.0 |
---|---|
Change log | CHANGELOG.md |
Dependencies | base (>=4.12.0.0 && <4.13), bytestring, deepseq, gauge, hspec, optics-core, optics-regexp, pcre-heavy, template-haskell, text [details] |
License | BSD-3-Clause |
Copyright | 2020 lawrencebell |
Author | Lawrence Bell |
Maintainer | Lawrence Bell <lawrence.matthew.bell@gmail.com> |
Category | Lenses, Optics, Regex |
Bug tracker | https://github.com/lawrencebell/optics-regexp/issues |
Source repo | head: git clone https://github.com/lawrencebell/optics-regexp |
Uploaded | by lawrencebell at 2020-04-28T13:37:34Z |
library optics-regexp
Modules
- Optics
- Regex
- ByteString
- Optics.Regex.ByteString.Lazy
- Optics.Regex.ByteString.Strict
- Optics.Regex.String
- Text
- Optics.Regex.Text.Lazy
- Optics.Regex.Text.Strict
- ByteString
- Regex
library optics-regexp:optics-regexp-internal-aux-skeleton
Signatures
- Deriv
- Deriv.StrMat
Modules
- Bench
- Spec
library optics-regexp:optics-regexp-internal-aux-skeleton-bytestring
Modules
- Deriv
- StrMat
- ByteString
- Deriv.StrMat.ByteString.Lazy
- Deriv.StrMat.ByteString.Strict
- ByteString
- StrMat
library optics-regexp:optics-regexp-internal-aux-skeleton-text
Modules
- Deriv
- StrMat
- Text
- Deriv.StrMat.Text.Lazy
- Deriv.StrMat.Text.Strict
- Text
- StrMat
library optics-regexp:optics-regexp-internal-aux-skeleton-string
Modules
- Deriv
- StrMat
- Deriv.StrMat.String
- StrMat
library optics-regexp:optics-regexp-internal-aux-bytestring
Modules
- Bench
- ByteString
- Bench.ByteString.Lazy
- Bench.ByteString.Strict
- ByteString
- Spec
- ByteString
- Spec.ByteString.Lazy
- Spec.ByteString.Strict
- ByteString
library optics-regexp:optics-regexp-internal-aux-text
Modules
- Bench
- Text
- Bench.Text.Lazy
- Bench.Text.Strict
- Text
- Spec
- Text
- Spec.Text.Lazy
- Spec.Text.Strict
- Text
library optics-regexp:optics-regexp-internal-aux-string
Modules
- Bench
- Bench.String
- Spec
- Spec.String
library optics-regexp:optics-regexp-internal-lib-skeleton
Signatures
- StrBldr
Modules
- Optics
- Optics.Regex
library optics-regexp:optics-regexp-internal-lib-skeleton-bytestring
Modules
- StrBldr
- ByteString
- StrBldr.ByteString.Lazy
- StrBldr.ByteString.Strict
- ByteString
library optics-regexp:optics-regexp-internal-lib-skeleton-text
Modules
- StrBldr
- Text
- StrBldr.Text.Lazy
- StrBldr.Text.Strict
- Text
library optics-regexp:optics-regexp-internal-lib-skeleton-string
Modules
- StrBldr
- StrBldr.String
library optics-regexp:optics-regexp-internal-lib-bytestring
Modules
- Optics
- Regex
- ByteString
- Optics.Regex.ByteString.Lazy
- Optics.Regex.ByteString.Strict
- ByteString
- Regex
library optics-regexp:optics-regexp-internal-lib-text
Modules
- Optics
- Regex
- Text
- Optics.Regex.Text.Lazy
- Optics.Regex.Text.Strict
- Text
- Regex
library optics-regexp:optics-regexp-internal-lib-string
Modules
- Optics
- Regex
- Optics.Regex.String
- Regex
Downloads
- optics-regexp-0.1.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
Package maintainers
For package maintainers and hackage trustees