Regex to Delete Duplicate Lines
// http://www.regular-expressions.info/duplicatelines.html var pattern = new RegExp(/^(.*)(\r?\n\1)+$/);