Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype GroupReplacer b = GroupReplacer (MatchArray -> ReplaceAcc b -> ReplaceAcc b)
- data ReplaceAcc b = ReplaceAcc {}
- type PosLen = (MatchOffset, MatchLength)
- type E a = Either String a
- newtype Once a = Once a
- newtype All a = All a
- data Regex :: *
- type MatchArray = Array Int (MatchOffset, MatchLength)
- newtype CompOption :: * = CompOption CInt
- data ExecOption :: *
Documentation
newtype GroupReplacer b Source #
see Text.Regex.Do.Replace.Open defaultReplacer
for example implementation
GroupReplacer (MatchArray -> ReplaceAcc b -> ReplaceAcc b) |
(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 # | |
data ReplaceAcc b Source #
type PosLen = (MatchOffset, MatchLength) Source #
Offset, Length
Once a | replace once |
Functor Once Source # | |
Applicative Once Source # | |
(RegexLike Regex b, Replace Maybe repl b) => Replace Once Regex repl b b Source # | succeeds unless repl: |
Replace Maybe repl ByteString => Replace Once Regex repl ByteString ByteString Source # | succeeds unless repl: |
Replace Once Regex String String String Source # | always succeeds |
(RegexLike Regex b, Regex b) => Replace Once b b b (E b) Source # | b: |
Replace Once String String String (E String) Source # | |
Replace Once ByteString ByteString ByteString (E ByteString) Source # | |
(RegexLike Regex b, Regex b) => Replace Once b (GroupReplacer b) b (E b) Source # | b: |
Replace Once ByteString (GroupReplacer ByteString) ByteString (E ByteString) Source # | |
All a | replace all |
Functor All Source # | |
Applicative All Source # | |
(RegexLike Regex b, Replace [] repl b) => Replace All Regex repl b b Source # | succeeds unless repl: |
Replace [] repl ByteString => Replace All Regex repl ByteString ByteString Source # | succeeds unless repl: |
Replace All Regex String String String Source # | always succeeds |
(RegexLike Regex b, Regex b) => Replace All b b b (E b) Source # | b: |
Replace All String String String (E String) Source # | |
Replace All ByteString ByteString ByteString (E ByteString) Source # | |
(RegexLike Regex b, Regex b) => Replace All 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 |
A compiled regular expression
Regex Regex Source # | |
RegexOptions Regex CompOption ExecOption | |
RegexLike Regex b => MatchOnce Regex b Bool Source # | test. always succeeds |
RegexLike Regex b => MatchOnce Regex b Bool Source # | b: always succeeds |
(RegexLike Regex b, Replace [] repl b) => Replace All Regex repl b b Source # | succeeds unless repl: |
(RegexLike Regex b, Replace Maybe repl b) => Replace Once Regex repl b b Source # | succeeds unless repl: |
Replace [] repl ByteString => Replace All Regex repl ByteString ByteString Source # | succeeds unless repl: |
Replace All Regex String String String Source # | always succeeds |
Replace Maybe repl ByteString => Replace Once Regex repl ByteString ByteString Source # | succeeds unless repl: |
Replace Once Regex String String String Source # | always succeeds |
RegexLike Regex b => MatchAll Regex b [[PosLen]] Source # | always succeeds |
RegexLike Regex b => MatchAll Regex b [[b]] Source # | always succeeds |
RegexLike Regex b => MatchOnce Regex b [PosLen] Source # | always succeeds |
RegexLike Regex b => MatchOnce Regex b [b] Source # | always succeeds |
RegexLike Regex b => MatchAll Regex b [[PosLen]] Source # | b: always succeeds |
RegexLike Regex b => MatchAll Regex b [[b]] Source # | b: always succeeds |
RegexLike Regex b => MatchOnce Regex b [PosLen] Source # | b: always succeeds |
RegexLike Regex b => MatchOnce Regex b [b] Source # | b: always succeeds precompiled regex as patternlet Right rx1 = makeRegexOpt (toByteString "左") [Utf8] [] -- add options as needed
m1 = rx1 ~? (toByteString "100メートル左折後、左")::[ByteString]
m1 |
type MatchArray = Array Int (MatchOffset, MatchLength) #
0 based array, with 0th index indicating the full match. If the full match location is not available, represent as (0,0).
newtype CompOption :: * #
data ExecOption :: * #