a alguien se le ocurre o ya ha hecho antes una funcion ke busque URL's dentro de un string en .Net??
Saludos y gracias de antemano
| ||||
| hola, a ver si te sirve este ejemplo: http://www.programar.net/articles3/regex.aspx está en C# pero bueno en VB es similar. saludos! |
| ||||
| En VB.net sería así...
Código:
Public Function UrlList(ByVal url As String) As ArrayList
Dim resultHTML() As Byte
Dim linksArray As ArrayList = New ArrayList
Dim myWebClient As WebClient = New WebClient
resultHTML = myWebClient.DownloadData(url)
Dim utf8Enc As UTF8Encoding = New UTF8Encoding
Dim myResultString As String = utf8Enc.GetString(resultHTML)
myResultString = myResultString.ToLower
Dim regularexpre As Regex = New Regex("href\\s*=\\s*(?:(?:\\\""(?<url>[^\\\""]*)\\\"")|(?<url>[^\\s]* ))")
Dim collectionUrls As MatchCollection = regularexpre.Matches(myResultString)
For Each res As Match In collectionUrls
For Each t As Group In res.Groups
linksArray.Add(t.Value)
Next
Next
Return linksArray
End Function
|
| ||||
| gracias por responder pero no quiero buscar una url especifica sino cualkier url dentro de un string, para eso en la expresion regular, en vez de <url> deberia ir un comodin pero no se casi nada de expresiones regulares entonces no se ke poner. ke deberia ir?? Saludos, |