0

I have searched alot about regular exprasions but i have not found any Comprehensive Expression. some of them which i have found in internet are dtecting only https or http lniks not other and wise virsa is there any Comprehensive expression for all of these ???

like:

    www.google.com
https://www.fb.com
http://ww.google.com
google.com
info/contact.php
www.google.com.uk

and much more

is there any

svick
  • 236,525
  • 50
  • 385
  • 514
Nomi
  • 29
  • 8
  • 2
    I imagine there is, but it might be a very ugly expression unless you're an expert in RegEx. I'd strongly suggest looking at [Html Agility Pack](http://htmlagilitypack.codeplex.com/) for parsing, rather than building your own RegEx. – Tim Jun 26 '13 at 07:56
  • http://stackoverflow.com/q/161738 – GSee Jun 29 '13 at 16:46
  • Html is not a regular language. Use the right tool for the job, an html parser. – Eric Lippert Jun 30 '13 at 01:10

1 Answers1

0

Have a look here http://regexlib.com/Search.aspx?k=URL&AspxAutoDetectCookieSupport=1

You can find a lot of examples and patterns there and there are a lot of general Regex tutorials and articles.

After a quick browse I found this :

([\d\w-.]+?\.(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|f[ijkmnor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eouw]|s[abcdeghijklmnortuvyz]|t[cdfghjkmnoprtvwz]|u[augkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|pro)(\b|\W(?<!&|=)(?!\.\s|\.{3}).*?))(\s|$)

Should do the trick, but I'm sure there are more elegant examples on that list.

Alex
  • 1,110
  • 8
  • 15