You are here: Re: Regex problems « All PHP « IT news, forums, messages
Re: Regex problems

Posted by Rik on 05/16/06 01:26

Juby wrote:
> preg_replace("/%email%/",$name,$mailbody);
>
> When that bit of code is run, the string "%email%" remains unchanged
> in $mailbody.

That's correct. You don't tell the function where to output the new string.

> I'm sure there's something wrong with my regular
> expression, but I just can't seem to figure out what it is.

Nope.

$mailbody = preg_replace("/%email%/",$name,$mailbody);

Sometimes you're looking in all the wrong places, forgetting the obvious
:-). (I have to confess that on my first try with regexes, I made the same
mistake. Took me almost over an hour pondering over the regex before I
realised it...)

Grtz,
--
Rik Wasmus

 

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

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