I have a funcion which is somthing like this :
function replaceXMLEntities($subject) {
$subject = str_replace("&", "&", $subject);
$subject = str_replace("'", "'", $subject);
$subject = str_replace("<", "<", $subject);
$subject = str_replace(">", ">", $subject);
$subject = str_replace("\"", """, $subject);
return $subject;
}
This function is used to convert strings to a safe string for xmpl encoding.
But i have a problem in which casses some xmpl data ges encoded 2 times, like
&
as imput gets to
&&
Just like in here when you enter the text without code quote :)
I need a regex which could distinguish between & and & somthing like
if not & then do & -> & conversion else dont touch it.
Any idea how i could achive such regex? I could go and make a funciton but in this case a regex is clearly a better option.