I have this code and I need to remove dot (.) only after TLD
<?php
$url ='15rm-mo.hello.com.';
$response = preg_replace('/[^A-Za-z1-9-]/', '', $url);
echo $response;
?>
here is the output: 15rm-mohellocom
What I need is this: 15rm-mohello.com removing dot at the end. I can add dot in the regex but both dot will be remove. Any idea? Thanks in advance.
ps: “15rm-mohello.com removing dot at the end.” so, just at the end or in the middle too?