Open source software security

Line Break Ripper

30 November -0001
I actually wrote this little code snippit to help me solve a problem with Cold Fusion MX Server. When you save a file it seemed to add extra line breaks that were bloating the code and making it impossible to edit. When you paste code into the text box created with the code below and click the 'fix' button it strips out the extra line breaks.

<html>
<head>
<script language="javascript">
function fixit()
	{
	var str = document.theForm.body.value;
	var str2 = str.replace(new RegExp('\n\n\n', 'g')," ");
	window.document.theForm.body.value = str2;
}
</script>
<body>
<form name="theForm">
<textarea name="body" rows="40" cols="40"></textarea>
<input type="button" value="fix" onClick="fixit()">
</body>
</html>