using System.Text.RegularExpressions;
public static void Main()
Regex appPathMatcher = new Regex(@"(?<!fil)([A-Za-z]:)?[\\\/\/]+[\S\s]*?(?=[\\\/\/]+bin)");
string pathWindows = appPathMatcher.Match("c:\\app\\bin").Value;
string pathLinux = appPathMatcher.Match("/app/bin").Value;
string filename = pathWindows + "\\log4net.config";
Console.WriteLine(pathWindows);
Console.WriteLine(pathLinux);
Console.WriteLine(filename);