phpmysqleregi

I need help about this old code ereg_replace


Good morning from Italy and sorry for my bad English :)

In to an old web application i need to make some change but i receive this warning :

ereg_replace is deprecated etc etc

I try to change :

eregi_replace("([0-9]*)(\/)([0-9]*)(\/)([0-9]*)","\\5-\\3-\\1",GetSQLValueString($_POST['dataordine'], "date")),

with :

preg_replace("([0-9]*)(\/)([0-9]*)(\/)([0-9]*)","\\5-\\3-\\1",GetSQLValueString($_POST['dataordine'], "date")),

but dont work ->

Warning: preg_replace(): Unknown modifier '(' in \www\testate_ins.php on line 23

What can i do ?

Thank you vary much for the help.

Bye.


Solution

  • Just put '/' on the begining and the end of pattern like this

    "/([0-9]*)(\/)([0-9]*)(\/)([0-9]*)/"
    

    and it should work.