Safe Haskell | None |
---|---|
Language | Haskell98 |
A module implementing regexp-based split and substitute.
>>>
substituteCompile "(a+)" "lapin" "'\\1'"
Right "l'a'pin"
>>>
splitCompile "\\d" "a1b2c3"
Right ["a","b","c"]
- substitute :: Regex -> ByteString -> ByteString -> IO (Either String ByteString)
- split :: Regex -> ByteString -> IO (Either String [ByteString])
- substituteCompile :: ByteString -> ByteString -> ByteString -> IO (Either String ByteString)
- splitCompile :: ByteString -> ByteString -> IO (Either String [ByteString])
- data Regex :: *
- data CompOption :: *
- data ExecOption :: *
- compBlank :: CompOption
- execBlank :: ExecOption
- compile' :: CompOption -> ExecOption -> ByteString -> Either (MatchOffset, String) Regex
- execute' :: Regex -> ByteString -> Either WrapError (Maybe (Array Int (MatchOffset, MatchLength)))
- substitute' :: Regex -> ByteString -> ByteString -> Either String ByteString
- split' :: Regex -> ByteString -> Either String [ByteString]
- substituteCompile' :: ByteString -> ByteString -> ByteString -> Either String ByteString
- splitCompile' :: ByteString -> ByteString -> Either String [ByteString]
Perl-like utility functions
:: Regex | The regular expression, taken from a call to |
-> ByteString | The source string |
-> ByteString | The replacement string |
-> IO (Either String ByteString) |
Substitutes values matched by a Regex
. References can be used.
It doesn't support anything else than global substitution for now ..
:: Regex | The regular expression, taken from a call to |
-> ByteString | The source string |
-> IO (Either String [ByteString]) |
Splits strings, using a Regex
as delimiter.
:: ByteString | The regular expression |
-> ByteString | The source string |
-> ByteString | The replacement string |
-> IO (Either String ByteString) |
Compiles the regular expression (using default options) and substitute
s
:: ByteString | The regular expression |
-> ByteString | The source string |
-> IO (Either String [ByteString]) |
Compiles the regular expression (using default options) and split
s.
Re-exports from Text.Regex.PCRE.ByteString
data CompOption :: *
data ExecOption :: *
Pure version of the functions, using unsafePerformIO
compile' :: CompOption -> ExecOption -> ByteString -> Either (MatchOffset, String) Regex Source
A pure version of compile
, using unsafePerformIO.
execute' :: Regex -> ByteString -> Either WrapError (Maybe (Array Int (MatchOffset, MatchLength))) Source
A pure version of execute
, using unsafePerformIO.
:: Regex | The regular expression, taken from a call to |
-> ByteString | The source string |
-> ByteString | The replacement string |
-> Either String ByteString |
A pure version of substitute
, using unsafePerformIO.
:: Regex | The regular expression, taken from a call to |
-> ByteString | The source string |
-> Either String [ByteString] |
A pure version of split
, using unsafePerformIO.
:: ByteString | The regular expression |
-> ByteString | The source string |
-> ByteString | The replacement string |
-> Either String ByteString |
A pure version of substituteCompile
, using unsafePerformIO.
:: ByteString | The regular expression |
-> ByteString | The source string |
-> Either String [ByteString] |
A pure version of splitCompile
, using unsafePerformIO.