Matt,
You should use Server.HTMLEncode when displaying the contents of the field.
Use that first then perform your replace function.
It's wierd that you call this a RegExp question.
It's wierder still that you used RegExp at all
Dim sField ' contains value retrieved from DB.
sField = Server.HTMLEncode(sField)
sField = Replace(Replace(sField, vbCR, ""), vbLF, "<br />")
Note I kill all CRs then replace LFs. Depending other technologies you may
be using (one of note is XML) CRs can go missing leaving just LFs. LFs are
always there. The above code robustly handles this situation if it arises.
Anthony.
|