Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8409489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:55:31+00:00 2026-06-09T23:55:31+00:00

I need to modify HTML markup such that a matched word or phrase gets

  • 0

I need to modify HTML markup such that a matched word or phrase gets hightlighted, but that phrase may contain markup. For example:

This formatted text :

This <b>f<i>or</i>mat</b>ted text

I’d want to be able to find “This formatted” and wrap it in <style="color:lightblue" </span> tags

So the above would become:

 <span  style="color:yellow">This <b>f<i>or</i>mat</b>ted</span> text

I’m using PHP on linux.

Thanks

EDIT:
I’m not looking to replace tag but match text that has tags within it. Basically matching a string that may be spaced out with arbitrary tags of any type or length.
Please ignore my ancient html tags, they were just easier to type.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:55:32+00:00Added an answer on June 9, 2026 at 11:55 pm

    If I’m understanding the question correctly, you could use preg_match to find the specified string, then replace it with a version surrounded by your tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After build, I need to modify an HTML file that points the client to
I have got show|hide script. It work's good but I need to modify html
I have some HTML/CSS in this jsfiddle that I need to modify. Originally the
I need to modify a php search script so that it can handle multiple
I need to modify a column in a SQLite database but I have to
I need to modify a regular expression that matches a url for a redirect.
I need to modify the node content Array before it is rendered into html.
I was trying to load a php file in html such that the menu
I have a linked image that I need to specify height and width html
I'm trying to modify the HTML markup of a page in order to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.