Hi Thank you for reading my post. i want to check an string to see whether it is a correct web site name or not. I know that i should use regular expression , but i do not know how i should do this , can some one help me with this ?
However, I think it would be better to try to construct a java.net.URL object from the String. If it its a valid URL, the construction will succeed. If it is badly-formed, the constructor will throw MalformedURLException.
That will be good enough to detect many common errors in your URL. However, you may wish to go further. If the java.net.URL object is successfully constructed, you can then check whether the protocol is appropriate for a Web site. You can check this with the getProtocol() method; the protocol should be "http". You could also check that a host has been given, by testing whether the getHost() method returns a non-null, non-empty string.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.