// Collection of code snippets by Arne Vajhøj // posted to eksperten.dk, usenet and other places (2002-now) using System; using System.Text.RegularExpressions; namespace E { public class Program { private static string parsePhp(string php) { return "#" + php + "#"; } private static readonly Regex re = new Regex(@"(<\?)(.*?)(\?>)", RegexOptions.Compiled | RegexOptions.Singleline); public static string Parse(string s) { string res = s; foreach(Match m in re.Matches(s)) { res = res.Replace(m.Groups[0].Value, parsePhp(m.Groups[2].Value)); } return res; } public static void Main(string[] args) { string s = @" include(""inc/db.php""); include(""inc/layout.php""); print_header(); ?>