-2

我一直在尝试编写一个正则表达式来匹配网站的 URL。显然

(http:\/\/www.)([a-zA-Z0-9])(\.[a-zA-z])\/"\s

不起作用。URL 必须以http://www.并且最多可以包含一个或多个字母数字字符。

4

2 回答 2

2

输入谷歌怎么样:“正则表达式url”并点击第一个结果?

url 的正则表达式

于 2013-10-10T02:56:42.107 回答
1

使用 Apache Commons 的 UrlValidator:

http://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/UrlValidator.html

于 2013-10-10T02:56:44.047 回答