unfortunately, I have to deal with faulty HTML entities in a text, for example
·,
instead of the correct entity with the ending semicolon.
I tried
$pattern = "/^&[a-zA-Z]+?,/";
$replace = "/^&[a-zA-Z]+?;/";
$detailtext = preg_replace($pattern,$replace, $detailtext);
but it doesn't work... This is driving me nuts, I'm new to regular expressions and any help would be greatly appreciated!
Example for $detailtext:
$detailtext = "Unterputz-Einsätze<br>mit Federklemmen (Verbindungsklemmen nach VDE 0632). <br>Die Einsätze können wahlweise mit Standard- oder Flächenabdeckung <br>bestückt werden.<br>Wippschalter<br>10 AX 250 V&sim,<br>Ausführung: Universalschalter (Aus-Wechsel)<br>"
#in your pattern and·,does not contain the hash. So, it is not that surprising.$detailtextvalue^. See'~&[a-z]+[,;]~i.