【发布时间】:2015-06-22 11:34:46
【问题描述】:
从这样的字符串
<iframe width="560" height="315" src="https://www.youtube.com/embed/KRFHiBW9RE8" frameborder="0" allowfullscreen></iframe>
我只需要选择源,所以src="the string I need"之间的单词
我尝试过使用 IndexOf 单词 src=" 但链接没有固定数量的字符来设置结尾。
【问题讨论】:
-
你也应该在找到 src=" 后搜索 "
-
您必须在服务器端执行此操作吗?如果是这样,请不要使用魔术字符串,请考虑使用 HTMLAgilityPack
-
你可以控制这个 iframe 吗?我的意思是你会添加这个或者这个会从其他地方添加?
标签: c# html asp.net regex string