changed the implementation of replaceLists() using preg_split and preg_replace()