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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dotan Cohen wrote:
On 7/28/05, Jochem Maas <jochem@xxxxxxxxxxxxx> 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 hash signs. They didn't teach me THAT at the Primate
Programmers course...

Now on to google to go learn about those hash signs...

Dotan
http://lyricslist.com/lyrics/artist_albums/119/clapton_eric.php
Clapton, Eric Song Lyrics


There is nothing sacred about what you use for delimiters, just don't use preg's special characters and any characters contained in your pattern, obviously. Personally, I use "%" because I rarely use it an a pattern and it's easy to spot at the end.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux