this is some kind of variable content in javascript:
<meta charset="utf-8">
<title>Some Meep meta, awesome</title>
<-- some comment here -->
<meta name="someMeta, yay" content="meep">
</head>
I want to reduce the multi line breaks (unknown number) to a single line break while the rest of the formatting is still maintained. This should be done in javascript with a regex.
I have problems with the tabulator or to keep the format.
Try this:
This basically looks for two line breaks with only whitespace in between. And then it replaces those by a single line break. Due to the global flag
g, this is repeated for every possible match.edit:
Sure, simplest way would be to just look for three line breaks and replace them by two:
If you want to maintain the whitespace on one of the lines (for whatever reason), you could also do it like this: