title: How to replace a string with another in haskell
body: <p>I want to replace a string from an input file with a different string. I was searching for a method but it seems i can only alter the string character by character.  For example in the my code below</p>
  
  <pre><code>replace :: String -&gt; String 
  replace [] = [] 
  replace (x:xs) = if x == '@' then 'y':replace xs --y is just a random char
                               else x:replace xs
  
  searching :: String -&gt; IO String
  searching filename = do
      text &lt;- readFile filename
      return(replace text)
  
  
  main :: IO ()
  main = do
  
    n &lt;- searching "test.sf"
    writeFile "writefile.html" n 
  </code></pre>
  
  <p>I want to find the first occurrence of the string "@title", but i cant seem to find a method to do so as mentioned before, i can only access the char '@'. Is there a method for doing such a task. </p>