// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Text.RegularExpressions; namespace E { class MainClass { public static void Main(string[] args) { string rtf = @"{\rtf1\ansi\deflang1030\ftnbj\uc1{\fonttbl{\f0 \froman \fcharset0 Times New Roman;}{\f1 \fswiss \fcharset0 Arial;}{\f2 \froman \fcharset0Castellar;}{\f3 \fnil \fcharset0 Castellar;}}{\colortbl ;\red255\green255\blue255 ;\red0\green0\blue0 ;}{\stylesheet{\fs24\cf2\cb1 Normal;}{\cs1\cf2\cb1 Default ParagraphFont;}}\paperw11908\paperh16833\margl1800\margr1800\margt1440\margb1440\headery720\footery720\deftab720\formshade\aendnotes\aftnnrlc\pgbrdrhead\pgbrdrfoot\sectd\pgwsxn11908\pghsxn16833\marglsxn1800\margrsxn1800\margtsxn1440\margbsxn1440\headery720\footery720\sbkpage\pgncont\pgndec\plain\plain\f1\fs24\lang1030\f3\fs48 Tekst i RTF\par\plain\f1\fs24\par}"; Regex r = new Regex(@"\\par\}"); Match m = r.Match(rtf); if(m.Success) { Console.WriteLine("Found at " + m.Index); } else { Console.WriteLine("Not found"); } } } }