module Main where

import GHC.IO.Encoding (getForeignEncoding)
import Data.Bits (Bits((.&.)))
import Text.Regex.PCRE

testpcre re text = do putStrLn ("regex            : " ++ re)
                      putStrLn ("text             : " ++ text)
                      putStrLn ("String matchOnce : " ++ show mo)
                      putStrLn ("String match     : " ++ show m)
  where
    c = defaultCompOpt .&. compUTF8
    e = defaultExecOpt
    regex = makeRegexOpts c e re :: Regex
    mo = matchOnce regex text
    m = match regex text :: [[String]]

main = do enc <- getForeignEncoding
          putStrLn ("getForeignEncoding: " ++ show enc)
          putStrLn ""
          testpcre "país:(.*):(.*)" "país:Brasília:Brasil"

