鉴于以下内容:
->get()
我想从字符串中提取https://test.blob.core.windows.net/container-2/3a54d521-bf6f-4ffd-b19f-8656332a6ed?sv=2016-05-31&sr=c&sig=m88kVRUpsqGYKI0ChMTfjWt%2BW1bliQY1P4BjsW7YPs%3D&se=9999-12-31T23%3A59%3A59Z&sp=r
。我相信规则将是 -
3a54d521-bf6f-4ffd-b19f-8656332a6ed
之后的所有内容?
如何使用RegEx(或其他方法)实现这一目标?
答案 0 :(得分:1)
您可以像此代码一样使用Uri
string url = @"https://test.blob.core.windows.net/container-2/3a54d521-bf6f-4ffd-b19f-8656332a6ed?sv=2016-05-31&sr=c&sig=m88kVRUpsqGYKI0ChMTfjWt%2BW1bliQY1P4BjsW7YPs%3D&se=9999-12-31T23%3A59%3A59Z&sp=r";
var uri = new Uri(url);
Console.WriteLine(uri.Segments[2]);
Console.ReadLine();