// 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 { public class Tester { public static bool IsText(string s) { return Regex.IsMatch(s, "^\\\"[^\\\"]*\\\"$"); } public static bool ContainsText(string s) { return Regex.IsMatch(s, "\\\"[^\\\"]*\\\""); } } public class MainClass { public static void Test(string s) { Console.WriteLine(s + " IsText : " + Tester.IsText(s)); Console.WriteLine(s + " ContainsText : " + Tester.ContainsText(s)); } public static void Main(string[] args) { Test("abc"); Test("\"abc\""); Test("a\"b\"c"); } } }