#!/usr/bin/runghc module Main where import Text.Regex.PCRE get_subgroup :: (String, String, String, [String]) -> Int -> String get_subgroup (_, m, _, _) 0 = m get_subgroup (_, _, _, tl) i = tl !! (i - 1) main = do let i = "" let title = get_subgroup (i =~ "title='([^']*)'") 1 putStrLn ("title is |" ++ title ++ "|")