如何查找和返回匹配单词的文本

时间:2016-12-07 18:55:59

标签: php

我如何找到并返回有一些字符的单词?

$text = "Hi this is my website link: http://sub.link.com and an other one is lib.link.com/ex?indo=xb also another one link.com/lol.php"

preg_match("/\blink.com\b/", $text, $matches);
print_r($matches);

使用我的代码,它只返回与'blink.com'相匹配的相同单词但是我需要返回匹配单词的完整文本:

http://sub.link.com , lib.link.com/ex?indo=xb , link.com/lol.php

那怎么可能呢? TY

0 个答案:

没有答案