Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ea38f23b86
Fetching contributors…

Cannot retrieve contributors at this time

18 lines (14 sloc) 0.499 kb
import Text.Regex.Posix
import System.IO
main = do
handle <- openFile "3.data" ReadMode
contents <- hGetContents handle
putStrLn $ (concatSubMatches . getMatches) contents
hClose handle
-- extracts submatches from a list of [match, submatch] and concatenates them
concatSubMatches :: [[String]] -> String
concatSubMatches = concatMap f
where f [_,x] = x
-- returns a list of [match, submatch]
getMatches :: String -> [[String]]
getMatches x = x =~ "[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]"
Jump to Line
Something went wrong with that request. Please try again.