javascript replace /n with /r/n in java code example Example: javascript replace \n var r = "I\nam\nhere"; var s = r.replace(/\n/g,' ');