开发者

Retrieve and replace email address using preg_match & preg_replace

开发者 https://www.devze.com 2023-04-01 07:41 出处:网络
I want to retrieve email address from an article when the article is submitted and replace the email address w开发者_JAVA百科ith *.

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

精彩评论

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