Sounds like a weird thing to want to do, but this will do it: preg_replace('/(\w)\1$/','2',$str)
-Rasmus On Wed, 12 Jun 2002, Zac Hillier wrote: > Does anyone know how I can use preg or any other function to identify a > double letter on the end of a string and then replace it. > > So 'foo' would become 'f2' and 'bar' would not change. > > Thanks > > Zac > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php