lower but not

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

lower but not

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply