Question: is there a way of getting all the content of the page HTML , CSS , but exclude all the java script functions and script src?

```
        var htmlPage = $("html").html();
    console.log(htmlPage);

```

I know that will give me all of it. but I need to exclude the JS from the results

Answer: 
**EDIT:** fixed the regex (non-greedy version)

You can try this:

```
var htmlPage = $("html").html().replace(/<script[\s\S]*?<\/script>/mig, "");

```

The regular expression should match all `<script> ... </script>` tags and replace them with nothing.

---

BTW this is kind of a lucky shot because the regex itself requires the ending `</script>` to be escaped with a `\` backslash like this: `<\/script>`.

This escape character is why the regex doesn't match itself, which would cause it to fail. So, it works because by escaping it correctly it isn't self-similar anymore.
Another option is to use [Element.innerHTML](https://developer.mozilla.org/es/docs/Web/API/Element/innerHTML) and include the content that you want to get. For example: 

```html
<!doctype html>
<html>
  <head>
   <!--Css links goes here--> 
  </head>
  <body>
   <!--Your content-->
    <p>Hello World</p> 
  </body>
 <script>
 //Js
 </script>
<html>

```

```js
var body = document.body.innerHTML;
var head = document.head.innerHTML;

```

Then you can concadenate or whatever you want.