if (!strcmp($line, "<br>\n")) $line = "#br\n"; // <br> -> #br ...... ...... $line = preg_replace('/^#br$/', "<br>", $line);