我想验证URL的语法。我应该如何使用正则表达式来测试www.chaine.com之类的URL的有效性?
发布于 2011-04-06 22:11:42
你可以这样做,不需要正则表达式:
public boolean validateURI(String uri)
{
try
{
new URI(uri);
return true;
} catch(Exception e)
{
return false; // MalformedURI Exception, is the name I think
}
}URL extends URI你可以说我认为..。
https://stackoverflow.com/questions/5567582
复制相似问题