Page 1 of 1

lower but not

Posted: Sat Aug 27, 2005 9:29 am
by shiznatix
ok i have this

Code: Select all

preg_replace('/'.$keys[$i].'/', '<a href="'.$filename.'">'.$keys[$i].'</a>', $oldlines, 1);
which works just nice and fine but I need to have it so that it will replace the $keys[$i] no matter what case it is in like caps or all lower or whatever. how can i do this?

Posted: Sat Aug 27, 2005 9:31 am
by feyd
the i pattern modifier.

Code: Select all

preg_replace('/'.preg_quote($keys[$i],'/').'/i', '<a href="'.$filename.'">'.$keys[$i].'</a>', $oldlines, 1);

Moved to Regex.