Reputation: 35
Suppose I have the following String: "Do you like cats AND dogs" I want to search the String for the word "AND" and replace it with "OR"
What I want to ask is if there is a function that can allow me to search and replace. I thought of using elem
but I think it only works with Lists
Upvotes: 1
Views: 265
Reputation: 153102
Using the regex-applicative package:
Text.Regex.Applicative> replace ("OR" <$ string "AND") "cats AND dogs AND lizards"
"cats OR dogs OR lizards"
Upvotes: 2