Question: **THE SITUATION:**

I need to cut a specific part of a string.
That part will not always be the same in length and content.

The only thing i know is that it will always start with: `<style>`
and finish with: `</style>`

All the content in the middle must cut out (style tag included).

**THE QUESTION:**

How can i cut a specific part of a string knowing only the begin and the end of that part?

Answer: 
try something like this:

```
var str = '<style> p {margin: 0; } </style> other text';
var result = str.replace(/\<style\>.*\<\/style\>/, '');

```

[**DEMO**](https://jsfiddle.net/vLme1bps/)

**UPD:** For getting content in tag `style` (style tag included) try this:

```
var result = str.match(/\<style\>.*\<\/style\>/)[0]

```

[**DEMO**](https://jsfiddle.net/vLme1bps/4/)
You can manipulate DOM directly with javascript without regex or jquery. You need to select the parent element of the target element/class/id and then remove the child.

HTML:

```
<html>
  <head>
    <style>
      body {color:blue;}
    </style>
  </head>
  <body>

```

JavaScript:

```
var text = document.querySelectorAll("style")[0];
text.parentNode.removeChild(text);

```

Demo in <https://jsfiddle.net/kt6feq92/>