I have a snippet of PHP that replaces all characters from the left not being Unicode letters. It works fine, with one exception, and I can't figure out why. Can anyone help?
<?php
$B=$A;
do{
$A=$B;
$B=preg_replace('/^[^\pL\s]/','',$B);
}
while($B!=$A);
echo $B;
?>
If I feed it with a string like "\\*^&\\\@@\816.80831téstmé"
it nicely spits out "téstmé"
.$A="*^&\\\@@\816.80831[+"
gives an empty string, also correct.
But, when I enter "\\*^&\\\@@\816.80831"
, I end up with "831"
, when in fact it should be an empty string.
"^&\\\@@\8016.8048.31"
gives "48.31"
"^&\\\@@\8016.8148.31"
gives an empty string correctly"^&\\\@@\8016.8148067"
gives "16.8148067"
"^&\\\@@\8116.8148167"
the again is empty
It seems to have somethinh to do with the zero and the dot, but I can't find a pattern nor a solution. I tried adding strval, but still the same result.
Maybe someone has an answer? Thnx.