| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Text.Regex.Do.Type.Do
- newtype GroupReplacer b = GroupReplacer (MatchArray -> ReplaceAcc b -> ReplaceAcc b)
- data ReplaceAcc b = ReplaceAcc {}
- data Body b = Body b
- type PosLen = (MatchOffset, MatchLength)
- type E a = Either String a
Documentation
newtype GroupReplacer b Source #
see Text.Regex.Do.Replace.Open defaultReplacer for example implementation
Constructors
| GroupReplacer (MatchArray -> ReplaceAcc b -> ReplaceAcc b) |
Instances
| (RegexLike Regex b, Regex b) => Replace All b (GroupReplacer b) b (E b) Source # | b: |
| (RegexLike Regex b, Regex b) => Replace Once b (GroupReplacer b) b (E b) Source # | b: |
| 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 # | |
| Replace [] (GroupReplacer b) b Source # | |
| Replace Maybe (GroupReplacer b) b Source # | |
Haystack
Constructors
| Body b |
type PosLen = (MatchOffset, MatchLength) Source #
Offset, Length