C# 获取给定字符串中的特定句子

C# 获取给定字符串中的特定句子,c#,C#,示例字符串如下所示 {“这是allstate公司的url:{“以前”:https://graph.facebook.com/allstate/feedaccess_token=AAACEdEose24VEBPa9&limit=25&since=13369&__previous=1“,”获取的公司url“}} 我想从上面的字符串中提取 “https:\/graph.facebook.com/allstate/feedaccess\u token=AAACEdEose24VEBPa9&limit=2

示例字符串如下所示

{“这是allstate公司的url:{“以前”:https://graph.facebook.com/allstate/feedaccess_token=AAACEdEose24VEBPa9&limit=25&since=13369&__previous=1“,”获取的公司url“}}

我想从上面的字符串中提取

“https:\/graph.facebook.com/allstate/feedaccess\u token=AAACEdEose24VEBPa9&limit=25&since=13369&\uu previous=1”


如何做到这一点?在我的真实案例中,我需要获取字符串前后有许多句子。

看看,它可以将JSON字符串解析为一个有意义的对象,然后您可以在代码中与之交互。

这取决于文本的差异。如果它始终是https,并且url后面总是有逗号,那么您可以使用它此正则表达式:

.“(https://.+)”,。 互联网上有很好的工具来开发正则表达式。
例如

你不是在三小时前问了这个问题,结果被否决了很多吗?@ThorstenDittmar:是的-看@marc_s:也找到了,只是在寻找。原始海报:我建议你重新表述你的问题,这样我们就可以看到最小的工作量。我们不是来写你的软件的-向我们展示你的尝试,我们可以帮助你那么。
string strUrl = string.Empty;
string strPattern = @".*"(https://.+)",.*";
Match match = Regex.Match(strLine, strPattern, RegexOptions.IgnoreCase);
if (match.Success)
{
  strUrl = match.Groups[1].Value;
}