Created
February 15, 2016 03:14
-
-
Save SoldierCorp/100b77ec74d113be9712 to your computer and use it in GitHub Desktop.
Javascript nl2br
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nl2br(str) { | |
var break_tag = '<br>'; | |
return (str + '').replace(/([^>rn]?)(rn|nr|r|n)/g, '' + break_tag + ''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment