<?php $string = "An example of a website would be google.com or similar. However this is not what we are looking for"; $tlds = ['com', 'org', 'net']; echo preg_replace('~\.(?!(?:' . implode('|', $tlds) . ')\b)~i', '?', $string);
You have javascript disabled. You will not be able to edit any code.