I want
ereg ($rat, $dog, $cat)
to become
preg_match ('#'.$rat.'#', $dog, $cat)
To achieve this, I did
echo 'ereg ($rat, $dog, $cat)' | sed "s/ereg\(.*\)(\(.*\),/preg_match\1('#'.\2.'#',/g"
but, this regex changed the
ereg ($rat, $dog, $cat)
into
preg_match ('#'.$rat, $dog.'#', $cat)
instead of
preg_match ('#'.$rat.'#', $dog, $cat)
Can someone help me to build a regex that changes
ereg ($rat, $dog, $cat)
into
preg_match ('#'.$rat.'#', $dog, $cat)
Best Answer
Just exclude ','...