VB.net正则表达式(网站提取器)
到目前为止,我有这个VB.net正则表达式(网站提取器),vb.net,debugging,Vb.net,Debugging,到目前为止,我有这个 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim regx As New Regex("https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?", RegexOptions.IgnoreCase) Dim mactches As MatchCollection = regx.Matches(Input)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim regx As New Regex("https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?", RegexOptions.IgnoreCase)
Dim mactches As MatchCollection = regx.Matches(Input)
For Each match As Match In mactches
TbOutput.Text = TbOutput.Replace(match.Value, [String].Format("<a href=""{0}"" target=""_blank"">{0}</a>", match.Value))
Next
我想知道我做错了什么。TbOutput.Text=TbOutput.Replace出现错误,然后我输入了一个.Split,但也不起作用,再加上我的regx.matcheInput出现错误。输入部分给了我一个错误。我想知道是否必须在其中添加其他内容。什么类型的错误?输入的具体内容是什么?另外,我相当肯定错误主要是因为您需要TbOutput.Text.Replace;文本框不是字符串,因此几乎没有相同的方法。For循环中也有一个输入错误,但是呃。