help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking parameters


From: Cecil Westerhof
Subject: Re: Checking parameters
Date: Sun, 17 Jun 2007 20:01:38 +0200
User-agent: KNode/0.8.0

Lennart Borgman (gmail) wrote:
> (defunregulars(time)
>    (interactive "sHH:MM: ")
>    (let ((timelist (split-string time ":"))
>          (errmsg "Time format error"))
>      (save-match-data
>        (unless (string-match "\\`[0-9]+:[0-9]\\{2\\}\\'" time)
>          (error errmsg)))
>      (+
>       (string-to-number (nth 0 timelist))
>       (/
>        (string-to-number (nth 1 timelist))
>        60.0))))

Works like a charm. I only changed the regular expression to
        "\\`[0-9]\\{1,2\\}:[0-9]\\{2\\}\\'"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]