Re: [PHP] FAQ: replace first instance (couldn't find in archive)

2005-07-28 Thread Al
Dotan Cohen wrote: On 7/28/05, Jochem Maas <[EMAIL PROTECTED]> wrote: Dotan, now _I'm_ sending _you_ multiple copies (last one didn't go to the list by mistake!) php -r ' echo preg_replace("#the#","a","Then the big bear ate the little cat in the north of the woods.",1), "\n"; ' Wow! It wa

Re: [PHP] FAQ: replace first instance (couldn't find in archive)

2005-07-28 Thread Dotan Cohen
On 7/28/05, Jochem Maas <[EMAIL PROTECTED]> wrote: > the hash signs are regexp delimiters - you don't ness. need to use hash signs, > normally I either use # or / . > > some of the examples here http://nl2.php.net/preg_replace use @ > > in short read this (like 10 times :-): > http://nl2.php.net/

Re: [PHP] FAQ: replace first instance (couldn't find in archive)

2005-07-28 Thread Jochem Maas
Dotan Cohen wrote: On 7/28/05, Jochem Maas <[EMAIL PROTECTED]> wrote: Dotan, now _I'm_ sending _you_ multiple copies (last one didn't go to the list by mistake!) php -r ' echo preg_replace("#the#","a","Then the big bear ate the little cat in the north of the woods.",1), "\n"; ' Wow! It wa

Re: [PHP] FAQ: replace first instance (couldn't find in archive)

2005-07-28 Thread Dotan Cohen
On 7/28/05, Jochem Maas <[EMAIL PROTECTED]> wrote: > Dotan, > now _I'm_ sending _you_ multiple copies (last one didn't go to the list by > mistake!) > > php -r ' > echo preg_replace("#the#","a","Then the big bear ate the little cat in the > north of the woods.",1), "\n"; > ' Wow! It was those h

Re: [PHP] FAQ: replace first instance (couldn't find in archive)

2005-07-28 Thread Jochem Maas
Dotan, now _I'm_ sending _you_ multiple copies (last one didn't go to the list by mistake!) Dotan Cohen wrote: I've seen this discussed before, but no solution seems to have ever been suggested. I'd like to replace the first instance of a substring in a string. So if we were to replace the firs

[PHP] FAQ: replace first instance (couldn't find in archive)

2005-07-28 Thread Dotan Cohen
I've seen this discussed before, but no solution seems to have ever been suggested. I'd like to replace the first instance of a substring in a string. So if we were to replace the first 'the' with 'a' in the sentance "Then the big bear ate the little cat in the north of the woods." we would have: "