Olá pessoal, tudo bom?
Segue uma dica rápida para quem está precisando encontrar URLs dentro de textos/strings. Veja o trecho de código abaixo:
public string DevolveURL(string texto) { Regex regx = new Regex("http://([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?", RegexOptions.IgnoreCase); Match url = regx.Match(texto); if (url != null) { if (url.Value != string.Empty) return url.Value; else return string.Empty; } else return string.Empty; }
Grande abraço a todos!
Eduardo Henrique Rizo
[twitter-follow screen_name=’eduardorizo’ show_count=’yes’]
Bacana…