<?php
$input = "textmdwrhfejhg../0005456,2222233333,34erw.re.ty";

//Here's mine :
$repl1 = preg_replace("/[^0-9,.]/", "", $input);
//following line just removes one zero, i want it to remove all chars like
//Input : 000549,569     Output : 549,569
$repl2 = preg_replace("/^0/", "",$repl1);
$repl3 = str_replace(".","",$repl2);
preg_match('/[0-9]+(?:\,[0-9]{2}){0,2}/', $repl3, $matches);
$repl4 = preg_replace('/(\d)(?=(\d{3})+(?!\d))/', '$1.', $matches[0]);
echo $repl4;