blob: b9a311c1e6ebf4e052667cfe54b80ae555622c39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
module Types.Reminder.CmdLine where
import Text.Regex.Posix ((=~))
data CmdLineRemType = RelativeCLRem | AbsoluteCLRem
deriving (Eq, Show, Ord, Bounded)
cmdLineRemType :: String -> Maybe CmdLineRemType
cmdLineRemType exp
| exp =~ relativeRegExp = Just RelativeCLRem
| exp =~ absoluteRegExp = Just AbsoluteCLRem
| otherwise = Nothing
where
relativeRegExp = "[0-9mh]+[mh]"
absoluteRegExp = "[0-9]{1,2}(:[0-9][0-9])?(am|pm)?"
|