简体   繁体   中英

How can I do regex search and replace using Haskell's text-icu package?

The Hackage page [1] for this package says "Features include ... Regular expression search and replace" but I can't seem to find any functions that do this. I looked in the top-level module page [2] and also the Data.Text.ICU.Regex page but found nothing.

[1] http://hackage.haskell.org/package/text-icu

[2] http://hackage.haskell.org/packages/archive/text-icu/0.6.3.4/doc/html/Data-Text-ICU.html

It looks like you would have to construct a text replacement function yourself from the start and end functions in Data.Text.ICU.Regex . Note that the Regex object is stateful, and you have to attach text to it and then perform a search before asking for the bounds. It's not idiomatic Haskell, that's for sure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM