正则:获取链接的主要域名

https://pianpai.com/xxxadas

1
https:\/\/[^\/]+

获取结果为:https://pianpai.com

http与https的区别

http://pianpai.com/yyyyyyy

1
http:\/\/[^\/]+

获取结果为:http://pianpai.com

Leave a Reply

:?: :razz: :sad: :!: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: :smile: :evil:
贴图 表情 ( ps. 若要贴代码, 请將 "<" 改成 "&lt;" 即可, 此方法在所有 WP 网站均适用. )

RSS feed for comments on this post. TrackBack URL