module Main (main) where
import System.IO
import Text.Printf
import Text.Regex.Posix
import Text.Regex.Base
text = "http://www.abc.com/xyz"
regex = "http://([^/]+)"
main = print (getFirstMatch( text =~ regex :: [[String]]))
getFirstMatch :: [[String]] -> String
getFirstMatch s = (s !! 0) !! 1
Saturday, 5 January 2008
F#: Simple POSIX regular expression example
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment