当前位置:网站首页>php 匹配正则 取出url
php 匹配正则 取出url
2022-07-20 08:29:00 【安果移不动】
取出所有url 并且不要重复
function getJustAllUrl($inUrlText)
{
$parttern = "/http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[[email protected]&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+/";
preg_match_all($parttern, $inUrlText, $match);
return count($match) > 0 ? array_unique($match[0]) : '';
}
取出仅仅url
function getJustUrl($inUrlText)
{
$parttern = "/http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[[email protected]&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+/";
preg_match($parttern, $inUrlText, $match);
return count($match) > 0 ? $match[0] : '';
}
边栏推荐
- JUC包下的常见类
- Reducing participation costs via incremental verification for Ledger systems learning notes
- 使用uniCloud云函数在小程序中解码微信运动步数
- Go method set
- Duplicate class com.amap.api.fence.DistrictItem found in modules jetified-3dmap-9.3.1.jar (com.amap.
- Two ways of QT multithreading implementation thread implementation
- IT7259Q-13、IT7259EX-24特征 可穿戴设备
- 让你的ggplot2支持markdown语法
- Introduction to Lua scripting language
- Google play product details, exam content
猜你喜欢
随机推荐
Introduction to the basic use of openresty
mp4封装解析
localtime()
flv封装解析
Getting started with microservices
R语言世界价值观调查作业
上课笔记(4)(2)——#572. 对抗赛(compete)
Openresty accesses redis and MySQL
php得到网站根目录,php获得网站根目录的几个方法
数字孪生虚拟现实的发展趋势
带你彻底认识String
Spss-kmeans聚类分析操作
R语言求微分
Rmarkdown与Word文档的交互
JUC包下的常见类
文件上传下载
研究一下 JSON.parse(JSON.stringify(obj))
Two ways of QT multithreading implementation thread implementation
Node JS processes pictures asynchronously and JSON text asynchronously
让你的ggplot2支持markdown语法