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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:10:46+00:00 2026-05-27T02:10:46+00:00

suppose i wrote my javascript in my aspx page like below <script type=text/javascript> function

  • 0

suppose i wrote my javascript in my aspx page like below

<script type="text/javascript">
function pop() {
    // test 1

    /*  test1
        test2
        test3
    */
     myfunc1();
     myfunc1();
     myfunc1();
}

now at runtime i want to remove all javascript comment from the page using regex from render method of the page. so just tell me what regex i need to use.

protected override void Render(HtmlTextWriter writer)
    {
        using (HtmlTextWriter htmlwriter = new HtmlTextWriter(new System.IO.StringWriter()))
        {
            base.Render(htmlwriter);
            string html = htmlwriter.InnerWriter.ToString();

            if ((ConfigurationManager.AppSettings.Get("RemoveWhitespace") + string.Empty).Equals("true", StringComparison.OrdinalIgnoreCase))
            {

                // regex for removing html comment
                html = Regex.Replace(html, @"((<!-- )((?!<!-- ).)*( -->))(\r\n)*", String.Empty);
                // regex for removing line break & carriage return
                html = html.Replace(";\r\n", ";");
            }
            writer.Write(html.Trim());
        }
    }
  • 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-27T02:10:47+00:00Added an answer on May 27, 2026 at 2:10 am

    try this :

    ((\/\*[\s\S]+?\*\/)|(\/\/.+))
    

    http://regexr.com?2v8t8

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

Sidebar

Related Questions

In javascript suppose you have this piece of code: <div> <script type=text/javascript>var output =
Suppose to have a code like this: <div class=notSelected> <label>Name <input type=text name=name id=name
I wrote a little javascript function that checks for a cookie when onFocus is
I wrote a JavaScript function that fires when the user clicks OK in a
i am using asp.net4.0 in this aspx page one text box enter the rate,
Suppose I let the user to write a condition using Javascript, the user can
I wrote this function that's supposed to do StringPadRight("Hello", 10, "0") -> "Hello00000" .
So I've got an XHTML page with a script - not inline > <script
Suppose you created an online game in HTML5/JavaScript. All the code would be downloaded
I wrote a server-client app in javascript/HTML5 its supposed to allow clients to communicate/play

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.