<?php $re = '/(https?:\/\/|(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?)/m'; $str = 'Our website is <a href="www.me.com">www.me.com</a>'; $subst = '[x]'; $result = preg_replace($re, $subst, $str); echo $result;
You have javascript disabled. You will not be able to edit any code.