Re: preg
| From: | Rasmus Lerdorf | Date: | Wed, 12 Jun 2002 01:48:45 +0000 |
| Subject: | Re: preg | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101659@lists.php.net to get a copy of this message | ||
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
>