开发者

Retrieve and replace email address using preg_match & preg_replace

I want to retrieve email address from an article when the article is submitted and replace the email address w开发者_JAVA百科ith *.

I am using preg_match($pattern, $subject, $matches). Does not work throws an error.

$pattern looks like this

^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$

I want retrieve the email address and replace it * in the article.

I appreciate any help.


regex is:

#^[^\.][\w-\.]{1,64}[^\.]@([\w-\.]*)(\.\w{2,6})$#i
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜