Home  >  Article  >  Backend Development  >  javascript-php 正则获取二级域名。

javascript-php 正则获取二级域名。

WBOY
WBOYOriginal
2016-06-02 11:28:271397browse

正则javascriptphp

《a href="xxx.xxx.com"》测试《/a》
《a href="xxx.xxx.com/xxx/"》测试2《/a》
《a href="xxx.xxx.com/aaa/bbb.js?ss=aa"》测试3《/a》
《a href="xxx.xxx.com/xxx/sdadsde.html"》测试4《/a》

怎么用正则取出“ xxx.xxx.com”和“测试“,“xxx.xxx.com/xxx/”和“测试2”。
谢谢了!!!!(怕写被吞,就换成大写了,大神将就下...)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn