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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:05:58+00:00 2026-05-15T04:05:58+00:00

I have a table with 6 columns containing HTML content with some markups in

  • 0

I have a table with 6 columns containing HTML content with some markups in it and now when moving to a new designed site most of this HTML code has to be deleted. More or less all tags except <B> and </B>.

Is there a nice way of doing this, identify all tags end delete them within the data? I’m sure there are no < > symbols in the test so a regular expression would maybe work?

My alternative is to fetch every row, process it and update the database but I’m guessing this is possible to do in T-SQL directly.

My server is an MSSQL 2008 and is located in a hosted environment but I can fetch a local copy if needed.

Thanks,
Stefan

  • 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-05-15T04:05:59+00:00Added an answer on May 15, 2026 at 4:05 am

    To use Regular Expressions from SQL 2000 Link

    And from SQL 2005 up http://weblogs.sqlteam.com/jeffs/archive/2007/04/27/SQL-2005-Regular-Expression-Replace.aspx

    Amending that last link gives a Regex that appears to work from my extremely superficial testing on SQL2005 but for strings up to 4000 characters only!

    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Data.SqlTypes;
    using Microsoft.SqlServer.Server;
    using System.Text.RegularExpressions;
    
    public partial class UserDefinedFunctions
    {
        [Microsoft.SqlServer.Server.SqlFunction(IsDeterministic=true,IsPrecise=true)]
        public static SqlString StripAllButBoldTags(SqlString expression)
        {
            if (expression.IsNull)
                return SqlString.Null;
    
            Regex r = new Regex("</?([a-z][a-z0-9]*[^<>]*)>", RegexOptions.IgnoreCase);
    
            return new SqlString(r.Replace(expression.ToString(), new MatchEvaluator(ComputeReplacement)));
        }
    
        public static String ComputeReplacement(Match m)
        {
            return string.Compare( m.Groups[1].Value, "B",true) == 0? m.Value: "";
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 454k
  • Answers 454k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Polymorphism (very simply said) is a possibility to use a… May 15, 2026 at 9:58 pm
  • Editorial Team
    Editorial Team added an answer You can look in /proc/<PID>/task/ (where <PID> is a process-ID)… May 15, 2026 at 9:58 pm
  • Editorial Team
    Editorial Team added an answer Linux has an ASYNC_LOW_LATENCY flag for the serial driver that… May 15, 2026 at 9:58 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.