I want a regex but cannot get the right one -
The regex should be able to check a string where the 1st part before a . (dot) is any group of letters (case insensitive) or numbers. After the dot there is either .com or .co.xy where x and y are any 2 letters (case insensitive). I tried this but it didn't work:
/^(?!.*\.com+.co.**$).*$/
Some examples which would qualify:
ghikl.com
jk.com
k5343.com
lop.co.vb
kkkkpol.com
09k.co.lp
Asked
Active
Viewed 124 times
0

Yaan
- 561
- 1
- 5
- 7
-
Try `^[a-zA-Z0-9]+\.(com|co\.[a-zA-Z]{2})$` – TVOHM Mar 19 '16 at 22:40
-
tld are not necessarily two characters but could be of any length. – Saleem Mar 19 '16 at 22:41
-
Ok, one more thing - the above regex works only if I test it against an exact url. What if the url exists somewhere inside a full paragraph? – Yaan Mar 19 '16 at 22:52