New topic: Check datetime with regex
<http://forums.realsoftware.com/viewtopic.php?t=24005> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message spol Post subject: Check datetime with regexPosted: Tue Aug 19, 2008 11:46 am Joined: Fri Sep 30, 2005 8:08 am Posts: 31 Location: Bremen Hi, i like to check if a variable has datetime (yyyy-mm-dd h:i:s) format. Code: Function regex_validate_datetime(value as string) As boolean ' check datetime with regex Dim rg as New RegEx Dim myMatch as RegExMatch rg.SearchPattern="^([0-9]{4})\-([0-9]{2})\-([0-9]{2})\s\([0-9]{2})\:([0-9]{2})\:([0-9]{2})$" myMatch=rg.search(value) if myMatch <> Nil then return true else return false End if End Function msgbox str(regex_validate_datetime("2008-12-12 11:55:11")) I always get an nil error when calling the function but i do not have the experiance to find the error. can anybody help me with that function? Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 900 classes with 18000 functions in one REALbasic plug-in. The Monkeybread Software Realbasic Plugin v8.1. <http://www.monkeybreadsoftware.de/realbasic/plugins.shtml> [email protected]
