![]() |
Preg_match dd-mm-yyyy - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Preg_match dd-mm-yyyy (/showthread.php?tid=68064) |
Preg_match dd-mm-yyyy - wolfgang1983 - 05-19-2017 I have this code below which checks the date format dd/mm/yyyy But i need it to check it like dd-mm-yyyy Question: What is the correct preg_match that can check this dd-mm-yyyy not dd/mm/yyyy PHP Code: if ($this->input->post('dob')) RE: Preg_match dd-mm-yyyy - Rufnex - 05-19-2017 Try something like that (or use php checkdate method) Code: preg_match('/^(\d{2})-(\d{2})-(\d{4})$/', $this->input->post('dob')); RE: Preg_match dd-mm-yyyy - wolfgang1983 - 05-19-2017 (05-19-2017, 02:23 AM)Rufnex Wrote: Try something like that (or use php checkdate method) Thanks again for great help works perfect |