I want to put a space after anchor tag so that the next word becomes separate from it. The problem is there are anchor tags after which there is
characters or there could be another html tag opening. So in those cases we do not want to put a space
as it will break our records.
I only want to put space after anchor if there is no space and there is a word.
Right now i have come up with regex which i am not sure is exactly what i want
preg_replace("/\<\/a\>([^\s< ])/", '</a> $1', $text, -1, $count);
print "Number of occurence in type $type = $count
";
$this->count += $count;
I tried to see the number of occurence before i actually save the replaced string. But it is showing way higher amount which i highly doubt cannot be.
Please help me fixing this regex.
Scenarios:
<a href="blah.com">Hello</a>World // Here we need to put space between Hello and World
<a href="blah.com">Hello</a> World // Do not touch this
<a href="blah.com">Hello</a><b>World</b> // do not touch this
There could be so many cases that has to be ignore but specifically speaking we need the first scenario to be executed