url的格式是以下几种:
http(s)://username.spaces.live.com
http(s)://username.spaces.live.com/blog/dasdausername的命名规则是数字或者字母或者数字和字母组合。请问这样的正则表达式是什么?最好是js使用的。
http(s)://username.spaces.live.com
http(s)://username.spaces.live.com/blog/dasdausername的命名规则是数字或者字母或者数字和字母组合。请问这样的正则表达式是什么?最好是js使用的。
""
^http\://[a-zA-Z_0-9\-\.]+spaces.live.com
}
https://username.spaces.live.com
http://username.spaces.live.com/blog/dasda
正则:http(s)?://[a-zA-Z_0-9\-\.]+spaces.live.com(/blog/[^\.]*)?
匹配结果 :
捕获 1 :
https://username.spaces.live.com
==============================华丽的分隔线===============================
捕获 2 :
http://username.spaces.live.com/blog/dasda
==============================华丽的分隔线===============================
欢迎访问正则测试页http://www.17897.com/regextext.aspx
https://username.spaces.live.com
http://username.spaces.live.com/blog/dasda
取得成功
group["1"]是usernamePS:我是用The Regulator的