求正则表达式,在线等!!!
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
-
- 帖子: 52
- 注册时间: 2008-07-27 11:36
- 联系:
求正则表达式,在线等!!!
我想求一个关于URL的正则表达式,但是有要求.
要求:
1,URL中不能有协议,即:http,ftp,https等都不能有.
2,URL中不能有参数,即:?user=xx等都不能有
合法:
www.baidu.com
.....
不合法:
http://www.baidu.com?user=xxx
ftp://192.168.1.1/xxxx
.....
在线等!!!
要求:
1,URL中不能有协议,即:http,ftp,https等都不能有.
2,URL中不能有参数,即:?user=xx等都不能有
合法:
www.baidu.com
.....
不合法:
http://www.baidu.com?user=xxx
ftp://192.168.1.1/xxxx
.....
在线等!!!
-
- 帖子: 52
- 注册时间: 2008-07-27 11:36
- 联系:
- kofshower
- 帖子: 1343
- 注册时间: 2007-03-13 11:23
- 联系:
代码: 全选
^((\w+)\.)+(\w+)
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
-
- 帖子: 52
- 注册时间: 2008-07-27 11:36
- 联系:
- kofshower
- 帖子: 1343
- 注册时间: 2007-03-13 11:23
- 联系:
这个不也是一种参数形式么
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
-
- 帖子: 52
- 注册时间: 2008-07-27 11:36
- 联系:
-
- 帖子: 52
- 注册时间: 2008-07-27 11:36
- 联系:
- kofshower
- 帖子: 1343
- 注册时间: 2007-03-13 11:23
- 联系:
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
-
- 帖子: 52
- 注册时间: 2008-07-27 11:36
- 联系:
- kofshower
- 帖子: 1343
- 注册时间: 2007-03-13 11:23
- 联系:
上次由 kofshower 在 2008-08-05 17:52,总共编辑 1 次。
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
-
- 帖子: 52
- 注册时间: 2008-07-27 11:36
- 联系:
- kofshower
- 帖子: 1343
- 注册时间: 2007-03-13 11:23
- 联系:
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
-
- 帖子: 52
- 注册时间: 2008-07-27 11:36
- 联系:
kofshower
是不是我说的不够明白
我的意思是我要验证一个URL的合法
其次就是在这URL中不能带协议和参数
如果这2个有一个有的话,那么这个URL就不是合法的.
合法的为:
www.baidu.com
www.baidu.com/sss/fff/s.jsp
192.168.1.1:8080/sss/sss/ss.jsp
reseller.yahoo.com:8080/reseller
reseller.yahoo.com:8080/reseller/222/index.jsp
是不是我说的不够明白
我的意思是我要验证一个URL的合法
其次就是在这URL中不能带协议和参数
如果这2个有一个有的话,那么这个URL就不是合法的.
合法的为:
www.baidu.com
www.baidu.com/sss/fff/s.jsp
192.168.1.1:8080/sss/sss/ss.jsp
reseller.yahoo.com:8080/reseller
reseller.yahoo.com:8080/reseller/222/index.jsp
-
- 帖子: 52
- 注册时间: 2008-07-27 11:36
- 联系:
kofshower
是不是我说的不够明白
我的意思是我要验证一个URL的合法
其次就是在这URL中不能带协议和参数
如果这2个有一个有的话,那么这个URL就不是合法的.
合法的为:
www.baidu.com
www.baidu.com/sss/fff/s.jsp
192.168.1.1:8080/sss/sss/ss.jsp
reseller.yahoo.com:8080/reseller
reseller.yahoo.com:8080/reseller/222/index.jsp
是不是我说的不够明白
我的意思是我要验证一个URL的合法
其次就是在这URL中不能带协议和参数
如果这2个有一个有的话,那么这个URL就不是合法的.
合法的为:
www.baidu.com
www.baidu.com/sss/fff/s.jsp
192.168.1.1:8080/sss/sss/ss.jsp
reseller.yahoo.com:8080/reseller
reseller.yahoo.com:8080/reseller/222/index.jsp