I want to check whether user given URL is root domain or sub domain or exact page. Can anybody help me with the regex or let me know if there are any other methods?