You are here: Re: [PHP] FAQ: replace first instance (couldn't find in archive) « PHP « IT news, forums, messages
Re: [PHP] FAQ: replace first instance (couldn't find in archive)

Posted by Jochem Maas on 11/14/46 11:22

Dotan Cohen wrote:
> On 7/28/05, Jochem Maas <jochem@iamjochem.com> 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...

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/manual/en/reference.pcre.pattern.syntax.php

eventually it starts to sink in ;-)

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация