我需要匹配所有这些开始标记:
<p>
<a href="foo">
Run Code Online (Sandbox Code Playgroud)
但不是这些:
<br />
<hr class="foo" />
Run Code Online (Sandbox Code Playgroud)
我想出了这个,并希望确保我做对了.我只抓住了a-z.
<([a-z]+) *[^/]*?>
Run Code Online (Sandbox Code Playgroud)
我相信它说:
/,然后我有这个权利吗?更重要的是,你怎么看?
我是Python的新手.我正在学习正则表达式,但我需要帮助.
这里是HTML源代码:
<a href="http://www.ptop.se" target="_blank">http://www.ptop.se</a>
Run Code Online (Sandbox Code Playgroud)
我正在尝试编写一个只打印出来的工具http://ptop.se.你能帮我吗?
我正在尝试编写一个RegEx规则来查找我的网页上的所有href HTML链接,并向他们添加'rel ="nofollow"'.
但是,我有一个必须排除的URL列表(例如,任何(通配符)内部链接(例如pokerdiy.com) - 所以我的域名所在的任何内部链接都不包括在内.我想成为能够在排除列表中指定确切的URL - 例如 - http://www.example.com/link.aspx)
到目前为止,这是我的工作:
(] +)(HREF ="HTTP:?!//.*((pokerdiy))[^>] +>)
如果您需要更多背景/信息,可以在此处查看完整的主题和要求(跳过顶部以获取信息):http: //www.snapsis.com/Support/tabid/601/aff/9/aft/ 13117/AFV /主题/ afpgj/1/Default.aspx的#14737
我有一个C#函数,它返回一个字符串,格式如下:
string tableTag = "<th><a href="Boot_53.html">135 Boot</a></th>"
Run Code Online (Sandbox Code Playgroud)
我想获得href链接并存储到另一个名为link的字符串中:
string link = "Boot_53.html"
Run Code Online (Sandbox Code Playgroud)
我怎么能在C#中做到这一点?
嗨,我有问题让我的正则表达式工作.我正在使用C#asp.net我将发布我现在使用的代码,我无法工作的是获得href ="LINK"中的任何内容的第二个正则表达式
thx提前
var textBody = "lorem ipsum... <a href='http://www.link.com'>link</a>";
var urlTagPattern = new Regex(@"<a.*?href=[""'](?<url>.*?)[""'].*?>(?<name>.*?)</a>", RegexOptions.IgnoreCase);
//THIS IS THE REGEX
var hrefPattern = new Regex(@"HREF={:q}\>", RegexOptions.IgnoreCase);
var urls = urlTagPattern.Matches(textBody);
foreach (Match url in urls)
{
var hrefs = hrefPattern.Match(url.ToString());
litStatus.Text = hrefs.ToString();
}
Run Code Online (Sandbox Code Playgroud) 所以我有html文件.我需要从中提取所有链接和图像.基本上我需要:
<a href="this_is_what_I_need"> 和 <img src="this_is_also_needed">
我逐行阅读文件,可以得到它,但只有第一个:
List<string> links = new List<string>();
if (line.Contains(@"<a href=""") || line.Contains(@"<img src="""))
{
if (line.Contains(@"<a href=""")
{
links.Add(line.Split(new string[] { @"<a href""" }, StringSplitOptions.None)[1].Split('"')[0]);
}
else
{
links.Add(line.Split(new string[] { @"<a href=""" }, StringSplitOptions.None)[1].Split('"')[0]);
}
}
Run Code Online (Sandbox Code Playgroud)
但是一行可能包含多个链接和/或图像.那么如何获得所有?
我正在使用的第 3 方工具构建了一个锚标签,就像这样..
"<a href="http://DevNode/Lists/Publications.aspx#/publication/123">http://DevNode/Lists/Publications.aspx#/publication/123</a>"
Run Code Online (Sandbox Code Playgroud)
我需要隔离 href 以便我可以修剪它。目前我的模式
reg = /^(<a\shref=")? http:\/\/DevNode\/Lists\/Publications.aspx#\/publication\/(\d+)/i {lastIndex: 0}
Run Code Online (Sandbox Code Playgroud)
如果 href 有这样的前导空格,将无法匹配
"<a href=" http://DevNode/Lists/Publications.aspx#/publication/123"> http://DevNode/Lists/Publications.aspx#/publication/123</a>"
Run Code Online (Sandbox Code Playgroud)
请帮忙