在两个指定字符串之间查找字符串的正则表达式模式

use*_*395 2 c# regex

我有一个文本文件,我在C#中提取一行,如下所示:

Date: 8/20/2013 12:00:00 AM Source Path: \\build\PM\11.0.25.9\ Destination Path: C:\Users\Documents\testing\11.0.25.9\etc\ Folder Updated: 11.0.25.9 File Copied: 11052_0_X.pts
Run Code Online (Sandbox Code Playgroud)

提取我需要的变量的最简单方法是创建一个正则表达式模式来查找它.

所以我想说我正在尝试从这行文本中提取源路径.我如何创建一个模式,在两个字符串之间查找字符串.例如,如何从"源路径:"和"目标路径:"之间提取源路径字符串?

到目前为止,我所拥有的只有:Regex.Match(line,@"Source Path:");

要使用http://regexhero.net/tester/进行测试,显然它所做的只是寻找源路径:到目前为止.我怎么能向前看,直到字符串"Destination Path:"?

I4V*_*I4V 6

string input = @"Date: 8/20/2013 12:00:00 AM Source Path: \\build\PM\11.0.25.9\ Destination Path: C:\Users\Documents\testing\11.0.25.9\etc\ Folder Updated: 11.0.25.9 File Copied: 11052_0_X.pts";
string pattern = @"Source Path:(.+?)Destination Path:";

var src = Regex.Match(input,pattern).Groups[1].Value.Trim();
Run Code Online (Sandbox Code Playgroud)