laravel remove \n \r from string code example Example: remove line break html php preg_replace( "/\r|\n/", "", $yourString );