如何从字符串中获取url并将其存储到另一个字符串中“ [英] How to get url from string and store into another string"
本文介绍了如何从字符串中获取url并将其存储到另一个字符串中“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个如下字符串
I have a string like below
obj.HtmlNote = @"This is my site that we have to maintain:<a href='http://www.myapplation.html'>Click here</a>";
ViewBag.message = Session["objstr"] + obj.HtmlNote;
这里我想将网址拆分并存储到另一个字符串中,如下所示。
string emailbody =http://www.myapplation.html;
你能帮忙帮忙从这个striing获取url吗?
here i want to split the url and store into another string like below.
string emailbody="http://www.myapplation.html";
Could you please help how get url from that striing?
推荐答案
使用正则表达式:
Use a regex:
(?<=<a href=').*(?='>)
应该这样做。
这篇关于如何从字符串中获取url并将其存储到另一个字符串中“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文