php匹配url的正则表达式

2021-10-27 15:39:03 浏览数 (1)

代码语言:javascript复制
//https?://([-w.] ) (:d )?(/([w/_.]*(?S )?)?)?
//PHP Example: Automatically link URL's inside text.
$text = pregreplace('@(https?://([-w.] ) (:d )?(/([w/.]*(?S )?)?)?)@', '<a href="$1">$1</a>', $text);</pre> 

0 人点赞