{ local $_ = $amount; /\./ ? s/(?<=\d)(?=(\d{3})+(?:\.))/,/g : s/(?<=\d)(?=(\d{3})+(?!\d))/,/g; $amount = $_; } [download]
In reply to Re: simple regex by Roger in thread simple regex by Anonymous Monk