Dim RemoveRtf As New Regex("\{\*?\\[^{}]+}|[{}]|\\\n?[A-Za-z]+\n?(?:-?\d+)?[ ]?")
Dim TextWithRtf As String = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Courier New;}}{\colortbl ;\red8\green0\blue0;}{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\cf1\highlight0\f0\fs20 The quick brown fox jumps over a lazy dog.\par}"
Dim TextWithoutRtf As String = RemoveRtf.Replace(TextWithRtf, "")
Tips and tricks for .NET using ASP and VB code.
Remove Rich Text Formatting from a string
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment