Hi,
I am looking at wiki page about regex libraries in Haskell and cannot find any explanation why replace feature is missing.
regex-compat is an exception, but it is kind of deprecated library.
Hi,
I am looking at wiki page about regex libraries in Haskell and cannot find any explanation why replace feature is missing.
regex-compat is an exception, but it is kind of deprecated library.
regex-rure doesn’t have replacement (the underlying C library doesn’t have it) but you could implement it.
Regular expressions aren’t/weren’t always valued fully in the Haskell world.
Hledger.Utils.Regex has a simple replace.
regex: Toolkit for regex-base is a modern regex lib including replace.
The semantics of replacing seems rather hairy to me. Which match should we replace? Should we replace multiple matches? What if they are overlapping?
Here’s an easy way to do search-and-replace in Haskell. Try the streamEdit
function in replace-megaparsec: Find, replace, and split string patterns with Megaparsec parsers (instead of regex)
regex looks promising! @chris fyi many of the links on regex.uk are broken! The first link I clicked was examples.regex.uk, but I can’t resolve that name.
Sorry for the breakage. A change of host means those links aren’t easy to restore — I will replace them with working ones on the next release.