regex-easy-0.1.0.0: sugar for regex-pcre

Safe HaskellNone

Text.Regex.Easy

Description

This module provides perl-style pattern matching. It is intended for use with minimal Haskell knowledge, so it moves away from the complex regex-* type signatures for the sake of clarity, and always uses the same string types for source text and patterns. See tests in source code for a few examples.

Synopsis

Documentation

(=~+) :: Source -> Match -> [(Source, (MatchOffset, MatchLength))]Source

Convenience wrapper around '(=~)', that trades flexibility off for compactness.

(=~-) :: Source -> Match -> [Source]Source

Convenience wrapper for '(=~+)' that chops rarely needed offsets and lengths off the result.

(=~#) :: Source -> Match -> BoolSource

Convenience function for '(=~+)' with match result Bool.

(=~++) :: Source -> Match -> [[(Source, (MatchOffset, MatchLength))]]Source

Like '(=~+)', but find all matches, not just the first one.

replaceRegex :: Source -> Match -> ([(Source, (MatchOffset, MatchLength))] -> Maybe Source) -> SourceSource

Replace first match with result of a function of the match.

replaceRegexAll :: Source -> Match -> ([(Source, (MatchOffset, MatchLength))] -> Maybe Source) -> SourceSource

Replace all matches with result of a function of the match.