function nl2br (str, replaceMode, isXhtml) {
var breakTag = (isXhtml) ? '
' : '
';
var replaceStr = (replaceMode) ? '$1'+ breakTag : '$1'+ breakTag +'$2';
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, replaceStr);
}
function br2nl (str, replaceMode) {
var replaceStr = (replaceMode) ? "\n" : '';
// Includes
,
,
,
return str.replace(/<\s*\/?br\s*[\/]?>/gi, replaceStr);
}