I'm trying to work out a quick and simple way to remove the first two digits and a decimal from a string, if that is how it is made up.
I am half way there but need help to finish.
So (first is what I start with, 2nd is the result):
xx.yyy = yyy
aaaaa = aaaaa
test.hello = test.hello
a.test.b.x = a.test.b.x
aa.bb.cc = bb.cc
So it only removes 2 digits and a decimal if it exists like that. If it is three digits and a decimal then it isn't removed.
This is where I am so far:
$string = 'xx.hello';
$pattern = '/(2-digits)./i';
$replacement = ''; // remove if matched
echo preg_replace($pattern, $replacement, $string);
?>