You are here: Re: adding space between words preg_replace « PHP Programming Language « IT news, forums, messages
Re: adding space between words preg_replace

Posted by Jerry Stuckle on 10/29/07 21:29

joanna wrote:
> Hi, I'm using preg_replace to strip out a bunch of unwanted stuff from
> the database. However the results seem to bunch up. Here's what I'm
> doing
>
> $old = htmlspecialchars($row['name']);
>
> $new = preg_replace("/[^a-zA-Zs]/", "", $old);
>
> the results of this are
>
> TomSmith
>
> instead of
>
> Tom Smith
>
> What do I need to add to the expression to get the desired space
> between words?
>
>


Untried, but maybe something like:

$new = preg_replace("/[^a-zA-Z\s]/", "", $old);

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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