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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:05:32+00:00 2026-06-09T18:05:32+00:00

Possible Duplicate: Allow user submitted HTML in PHP I’m building a small tool that

  • 0

Possible Duplicate:
Allow user submitted HTML in PHP

I’m building a small tool that publishes web articles to our website. A lot of the times our users are copying and pasting directly from Microsoft Word into my wysiwyg editor. The editor copies all of the Word hidden tags.

My main issue I am trying to address is removing <span>. Word often throws in a lot of style attributes after the <span> tag. For example: <span style=" Arial, sans-serif; font-size: 10pt; ">.

Is there a way to remove the entire span tag? Regex?

  • 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-09T18:05:34+00:00Added an answer on June 9, 2026 at 6:05 pm

    If you’re set on using a regex for it you could try something like

    "/^(<span)+([A-Za-z0-9=,;:])*(>)+$/"
    

    Where the (<span)+(>)+ catches both opening and closing tags and the middle section should catch any attributes declared inline. Then you could use php preg_replace to replace all occurrences of this pattern with empty quotes or something like that.

    http://www.php.net/manual/en/function.preg-replace.php

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

Sidebar

Related Questions

Possible Duplicate: Allow php sessions to carry over to subdomains How to setup user
Possible Duplicate: HTML Text Input allow only Numeric input I used this script function
Possible Duplicate: How can I only allow certain filetypes on upload in php? i'm
Possible Duplicate: What's the best method for sanitizing user input with PHP? I'm using
Possible Duplicate: declare property as object? Why don't PHP attributes allow functions? I'm trying
Possible Duplicate: How to extract img src, title and alt from html using php?
Possible Duplicate: How to allow only numeric (0-9) in HTML inputbox using jQuery? I
Possible Duplicate: Create a CSV File for a user in PHP Even though title
Possible Duplicate: Workaround for basic syntax not being parsed Why don't PHP attributes allow
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP

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.