Jump to content

[SOLVED] Switching to regex?


Azu

Recommended Posts

Hello I'm used to using str_replace but now I want to switch to a regex solution since str_replace isn't working how I want it to work.

 

Can somebody please tell me how to use a regex function to act like str_replace, except without changing the capilization of letters?

 

For example, stri_replace('a test','<b>A test</b>','This is a test'); outputs '<b>A test</b>' (it changed the lowercase a to an upper case A).

 

How do I do it with a regex function so that it won't change the case?

 

This is for a search script that I am making, and have it change instances of the search phrase in the result to bold. It isn't supposed to change the case though. Please help.. I've never used regex before except copy and pasting regex that I found by searching, but I can't find this by searching.. x_x

Link to comment
https://forums.phpfreaks.com/topic/68977-solved-switching-to-regex/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.