replacement / substition with Haskell regex libraries

前端 未结 6 556
无人共我
无人共我 2021-02-04 01:20

Is there a high-level API for doing search-and-replace with regexes in Haskell? In particular, I\'m looking at the Text.Regex.TDFA or Text.Regex.Posix

6条回答
  •  耶瑟儿~
    2021-02-04 02:01

    You can use replaceAll from the Data.Text.ICU.Replace module.

    Prelude> :set -XOverloadedStrings
    Prelude> import Data.Text.ICU.Replace
    Prelude Data.Text.ICU.Replace> replaceAll "cat" "dog" "Bailey is a cat, and Max is a cat too."
    "Bailey is a dog, and Max is a dog too."
    

提交回复
热议问题