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 143499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:06:19+00:00 2026-05-11T08:06:19+00:00

Here is what I need to be able to do: I need to match

  • 0

Here is what I need to be able to do:

I need to match the following tag:

<SPAN style='TEXT-DECORATION: underline'>text sample</SPAN> 

I need to replace the span with an html3 compliant tag, but keep the text in between. The final tag should look like this after replacement:

<u>text sample</u> 

I’m just not good with regular expressions and can’t seem to come up with the answer.

Thank you in advance.

  • 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. 2026-05-11T08:06:19+00:00Added an answer on May 11, 2026 at 8:06 am

    Regular expressions are not designed for tag manipulation.

    If you have any form of nesting going on, it gets messy.

    However, given the very simple example provided you could perhaps do this:

    $MyString = preg_replace     ( '/(?si)<SPAN\s+style\s*=\s*'TEXT-DECORATION:\s*underline;?'\s*>(.*?)<\/SPAN>/'     , '<u>$1</u>'     , $MyString     ); 

    But this is flawed in many ways, and you are much better off using a tool designed for manipulating tags instead.

    Have a look at DOMDocument->loadHTML() and related functions.

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

Sidebar

Related Questions

Using the following text as a sample, I need to be able to extract
Java is the key here. I need to be able to delete files but
What is need is given the following string Other Text [[MyText]] Some Other Text
We've had an ongoing need here that I can't figure out how to address
Here's my issue: I need to close a process, already running, from a C#
Here is a snippet of CSS that I need explained: #section { width: 860px;
I need some mind reading here, since I am trying to do what I
Here at work, we often need to find a string from the list of
Here's the situation: we have an Oracle database we need to connect to to
Here's another C#/.NET question based merely on curiousity more than an immediate need ...

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.