Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Gemini 🤖

New Members
  • Posts

    2
  • Joined

  • Last visited

Gemini 🤖's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you so much! I'll definitely look into not using pipes. I still have a lot to learn about Reg Ex. Any good tutorials online that you guys know about?
  2. Hello, My knowledge of regular expressions is pretty limited; and I have to get something done very soon using them. I have a variable called $searchString. I've searched for strings in a database which have text that matches that provided string. I'd like to add <span class="highlight"> before the search string and close the span right after. Right now I have: preg_replace("|($searchWord)|Ui" , "<span class=\"highlight\">$searchString</span>" , $string); So, if the user searches for pAnTs, they will see: "I like to wear <span class="highlight>pAnTs</span> all day" instead of "I like to wear <span class="highlight>pants</span> all day", which is the exact string in the database with the proper cases. I want to simply replace the beginning and end of the search string with the highlight class, instead of all of it so that it looks exactly like it does in the database. Any help would be much appreciated. Sorry if this is a complete noob question (but unfortunately, I kind of am one).
×
×
  • 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.