regex-do-3.0.1: PCRE wrapper

Safe HaskellNone
LanguageHaskell2010

Text.Regex.Do.Replace.Utf8

Description

Synopsis

Documentation

class Replace hint pattern repl body out where Source #

see Text.Regex.Do.Replace.Latin for implemented types

GroupReplacer is implemented only for ByteString

Minimal complete definition

replace

Methods

replace :: (Extract' body, RegexLike Regex body) => hint pattern -> repl -> body -> out Source #

Instances

Replace [] repl ByteString => Replace All Regex repl ByteString ByteString Source #

succeeds unless GroupReplacer fails due to mismatched pattern etc

repl: ByteString | GroupReplacer ByteString

Methods

replace :: All Regex -> repl -> ByteString -> ByteString Source #

Replace All Regex String String String Source #

always succeeds

Replace Maybe repl ByteString => Replace Once Regex repl ByteString ByteString Source #

succeeds unless GroupReplacer fails due to mismatched pattern etc

repl: ByteString | GroupReplacer ByteString

Methods

replace :: Once Regex -> repl -> ByteString -> ByteString Source #

Replace Once Regex String String String Source #

always succeeds

Replace All String String String (E String) Source # 
Replace All ByteString ByteString ByteString (E ByteString) Source # 
Replace Once String String String (E String) Source # 
Replace Once ByteString ByteString ByteString (E ByteString) Source # 
Replace All ByteString (GroupReplacer ByteString) ByteString (E ByteString) Source #
replacer::GroupReplacer ByteString
replacer = defaultReplacer 1 tweak1
      where tweak1 bs1 = toByteString' $
                        if bs1 == toByteString "左" then
                              "ー右ー"
                               else "?"


    runFn1 `shouldBe` toByteString "100メートルー右ー折後、左"
        where runFn1 = let rx1 = toByteString "(?<=ル)(左)"
                           body1 = toByteString "100メートル左折後、左"
                       in replace (All rx1) replacer body1    
Replace Once ByteString (GroupReplacer ByteString) ByteString (E ByteString) Source #