( /), 99.99999999% :
<?php
$n = new DOMDocument();
$n->loadHTML('<p>Thats a good example :/ .. with a <a href="http://www.foobar.com">link</a> inside.</p>');
$x = new DOMXPath($n);
$instances = $x->query('//text()[contains(.,\':/\')]');
foreach($instances as $node){
if($node instanceof DOMText && preg_match_all('/:\//',$node->wholeText,$matches,PREG_OFFSET_CAPTURE|PREG_SET_ORDER)){
foreach($matches[0] as $match){
$newnode = $node->splitText($match[1]);
$newnode->replaceData(0,strlen($match[0]),'');
$img = $n->createElement('img');
$img->setAttribute('src','smily.gif');
$img = $newnode->parentNode->insertBefore($img,$newnode);
}
}
}
var_dump($n->saveHTML());
?>
, , , html (beit in wysiwyg , , "return" (img to text) - ( /strstr () src (, array (':/' = > 'frown.gif ')) - .