URL Validation

Hi guys,

I designed one form i that i hav one field URL …I want to validate that field as

  1. if user enters www.example.co.uk com then agian he tries to put the www.example.com/page1 or www.example.net …so on which leads to same site

  2. Truncate all spaces, as urls do not contain spaces

3 . check for and truncate “http://” and “https://”

If any duplicates found , then i hav to fire a warning

Please help me on this friends…Thanks in advance