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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:24:57+00:00 2026-06-04T11:24:57+00:00

I have a datatable that gets modified by having the html stripped out. During

  • 0

I have a datatable that gets modified by having the html stripped out. During the html strip if a <br>, <p> or <li> is encountered they are replace with System.Environment.NewLine. I am logging ever instance of the html strip process to a text file and the formatting looks fine in the log (all CRLF are preserved). However when the update method is called on the datatable and the data gets sent to the database the CRLF characters are all gone.

Code snippet:

public static class HtmlStripper
{
    static Regex _htmlRegex = new Regex("<.*?>", RegexOptions.Compiled);
    static Regex _liRegex = new Regex("<li>", RegexOptions.Compiled);
    static Regex _brRegex = new Regex("<(br)?(BR)?\\s?/?>\\s*", RegexOptions.Compiled);
    static Regex _pRegex = new Regex("</?[phPH].*?>\\s*", RegexOptions.Compiled);

    public static string StripTagsRegexCompiled(string source)
    {
        string noPorH = _pRegex.Replace(source, System.Environment.NewLine);
        string noBr = _brRegex.Replace(noPorH, System.Environment.NewLine);
        string noLi = _liRegex.Replace(noBr, System.Environment.NewLine + "t- ");
        return _htmlRegex.Replace(noLi, string.Empty);
    }

}
  • 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-04T11:24:58+00:00Added an answer on June 4, 2026 at 11:24 am

    SSMS removes CRLF in the data grid – however they are still there in the database. You can prove this by pressing CTRL-T which turns your results to TEXT instead of in the GRID. You can then press CTRL-D to return to having your results in a GRID.

    You can test this with:

    SELECT  'Not' + CHAR(10) + CHAR(13) + 'Together'
    

    First by showing the result in the GRID:

    (No Column name)
    Not  Together
    

    Then in the TEXT result:

    SQL Server parse and compile time: 
       CPU time = 0 ms, elapsed time = 0 ms.
    
    -------------
    Not
    
    Together
    
    (1 row(s) affected)
    
    
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    SQL Server parse and compile time: 
       CPU time = 0 ms, elapsed time = 0 ms.
    
    SQL Server Execution Times:
       CPU time = 0 ms,  elapsed time = 0 ms.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a asp DataList that gets populated by a DataTable . <asp:PlaceHolder ID=ph3
I am having a Datagrid that gets populated with values from a DataTable. In
I have implimented the example: http://www.datatables.net/examples/server_side/server_side.html only to discover that this example gets all
I have a PrimeFaces dataTable that gets refreshed on actions of various controls of
I have a DataTable that I manually created and loaded with data using C#.
I have a datatable that contains rows of transaction data for multiple users. Each
I have a datatable that I add to the chart in foreach loop as
I have a datatable that uses the cell editor function. In each row, I
I have 3 collection datatable that shows in this below Month: January ID NAME
I have a untyped DataTable that looks like this (srcTbl): date col_1 col_2 ...

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.