As much as I try I can't totally understand how to use preg_match.

I have downloaded an open source system from the internet that I want to use, but they use ergei in their code.

When I change it to preg_match I get all kinds of errors.

Can someone please help me and tell me what is this code trying to do and how to fix the error that I get?

!eregi ("^([0-9]?[0-9])+[-|/|.]+([0-9]?[0-9])+[-|/|.]+(([0-9]{2})|([0-9]{4}))$", $from_date, $date_regs)

I have changed it to !preg_match, but then I get this error:

Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in C:\wamp\www\millery\content\time\time\reports\timerpt.php on line 236

I keep trying to fix these eregi to preg_match and keep getting all kinds of errors.

Can someone please help?

[-|/|.] i don't understand that,

!preg_match("@^([0-9]?[0-9])+[-|/|.]+([0-9]?[0-9])+[-|/|.]+(([0-9]{2})|([0-9]{4}))$@i", $from_date, $date_regs)

The code is trying to match a date format, but it appears incorrect.

!preg_match('@^(\d{1,2})[-/\.](\d{1,2})[-/\.](\d{2}|\d{4})$@', $from_date, $date_regs)

Thank you very very much.

Do you know of any site where there is a nice tutorial to learn this function?

I looked at: http://www.php.net/preg_match and http://php.about.com/gi/o.htm?zi=1/XJ&zTi=1&sdn=php&cdn=compute&tm=29&f=10&tt=29&bt=1&bts=1&zu=http%3A//weblogtoolscollection.com/regex/regex.php

But still struggling to understand.

I don't see they are using the character: @ is this an openning and closing char for a preg_match pattern?

And the \d?

Any good tutorial out there?

Thanks again your answer did solve my error, but I would like to learn so I'll be able to solve all the eregi functions I still have in that code.

Thank you very much.

Going to check the site you sent me, this issue is very confusing to me, hopefully, I'll be able to clean my brain and understand.

Probably need to give it a break and try again tomorrow :)