regex-do-3.0.1: PCRE wrapper

Safe HaskellNone
LanguageHaskell2010

Text.Regex.Do.Split

Description

see Data.ByteString.Search package

break, split ops on ByteString

regex is treated as ordinary String

break & split are now /, -/, /-

replace moved to Text.Regex.Do.Replace.Fast

Synopsis

Documentation

class Split out where Source #

slices ByteString. drops needle

to avoid clash with Prelude:

import Prelude hiding((/))

or qualify / with alias e.g. (assuming this module is imported with S alias):

S./

body -> pattern -> result

Minimal complete definition

(/)

Methods

(/) :: ByteString -> ByteString -> out Source #

Instances

Split [ByteString] Source #
>>> "a bc de" / " "      -- space may be used

["a", "bc", "de"]

Split (ByteString, ByteString) Source #
>>> "a\nbc\nde" / "\n"

("a", "bc\nde")

class SplitFront out where Source #

keep needle @ front

Minimal complete definition

(-/)

Methods

(-/) :: ByteString -> ByteString -> out Source #

Instances

SplitFront [ByteString] Source #
>>> "a\nbc\nde" -/ "\n"

["a", "\nbc", "\nde"]

SplitFront (ByteString, ByteString) Source #
>>> "a\nbc\nde" -/ "\n"

("a", "\nbc\nde")

class SplitEnd out where Source #

keep needle @ end

Minimal complete definition

(/-)

Methods

(/-) :: ByteString -> ByteString -> out Source #

Instances

SplitEnd [ByteString] Source #
>>> "a\nbc\nde" /- "\n"

["a\n", "bc\n", "de"]

SplitEnd (ByteString, ByteString) Source #
>>> "a\nbc\nde" /- "\n"

("a\n", "bc\nde")

type T = (ByteString, ByteString) Source #

Break result: tuple

type L = [ByteString] Source #

Split result: list