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/)
Get the part string:

```
theString = 'asdfasdf<style>aaaaaaaaaaaaaa</style>bbbbbbbb'
targetString= theString.replace(/<\/style>/ig,'<style>').split('<style>')[1];

```

Delete the whole string:

```
theString = 'asdfasdf<style>aaaaaaaaaaaaaa</style>bbbbbbbb'
targetString= theString.replace(/<style>.*<\/style>/ig,'');

```