<?php $string = "Lorem ipsum random_5ac18d179707d dolor random_5ac18d179707d sit amet, consectetur random_5ac18decebd4e adipiscing elit. random_5ac18d179707d"; preg_match_all('~random_(\w+)~', $string, $m); echo strtr($string, array_combine($s = array_unique($m[1]), range(1, count($s))));
You have javascript disabled. You will not be able to edit any code.