in reply to substitute an enter with regular expressions

I think we may need more context from your post. Define "newline". Are we talking about a legitimate newline from a native text file on your OS, or something provided from a web browser (as might be seen by a multi-line input field in a CGI script, which is what I suspect is the case here). If it's the former, s/\n/<br>/g will do the job. If it's the latter, in my experience, line breaks here tend to be encoded using an ASCII CR, not a "newline". In that case, something like s/\cM/<br>/g is probably what you want. YMMV.