Re: Regular Expressions

From: Date: Thu, 16 Oct 2003 19:30:19 +0000
Subject: Re: Regular Expressions
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-166342@lists.php.net to get a copy of this message
On Thu, Oct 16, 2003 at 09:41:39PM +0300, Shmuel wrote: : Eugene Lee wrote: : >On Thu, Oct 16, 2003 at 03:35:57PM +0300, Shmuel wrote: : >: : >: I have a misspelled sentence like this: "I am not aIone". : >: I want to change the capital I to small l, but only in : >: the beginning of a word. : > : >This doesn't make sense. It sounds like you want to replace every : >occurance of 'I' inside a word with a 'l'. : > : > preg_replace('/(\B)I(\B)/', '\1l\2', $yourstring) : > : >Then again, I could be misreading. : : I want to replace every occurance of 'I' inside a word with a 'a', : but *NOT* in the beginning of the word. ie. Ill doesn't change, : but miIk changes to Milk. : : This is a problem that occurs whit subrip. It can't distinguish : between those two letters. Okay... so did my preg_replace() above work for you? Or not? If not, do you have examples of it not working?

« previous php.general (#166342) next »