tweak wording
This commit is contained in:
parent
d25fe21834
commit
a2612f17c6
@ -117,14 +117,12 @@ replaceBackReference :: MatchText String -> String -> String
|
|||||||
replaceBackReference grps ('\\':s@(_:_)) | all isDigit s =
|
replaceBackReference grps ('\\':s@(_:_)) | all isDigit s =
|
||||||
case read s of n | n `elem` indices grps -> fst (grps ! n)
|
case read s of n | n `elem` indices grps -> fst (grps ! n)
|
||||||
_ -> error' $ "no match group exists for backreference \"\\"++s++"\""
|
_ -> error' $ "no match group exists for backreference \"\\"++s++"\""
|
||||||
replaceBackReference _ s = error' $ "replaceBackReference called on non-backreference \""++s++"\", shouldn't happen"
|
replaceBackReference _ s = error' $ "replaceBackReference called on non-numeric-backreference \""++s++"\", shouldn't happen"
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
-- http://stackoverflow.com/questions/9071682/replacement-substition-with-haskell-regex-libraries :
|
-- http://stackoverflow.com/questions/9071682/replacement-substition-with-haskell-regex-libraries :
|
||||||
-- | Replace all occurrences of a regexp in a string using a replacer
|
-- | Replace all occurrences of a regexp in a string, transforming each match with the given function.
|
||||||
-- function, which receives the matched string as its argument.
|
|
||||||
-- Does not support backreferences or other RE syntax.
|
|
||||||
replaceAllBy :: Regex -> (String -> String) -> String -> String
|
replaceAllBy :: Regex -> (String -> String) -> String -> String
|
||||||
replaceAllBy re f s = start end
|
replaceAllBy re f s = start end
|
||||||
where
|
where
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user