You are here: Re: replace non-letters with underscore « PHP Language « IT news, forums, messages
Re: replace non-letters with underscore

Posted by Tyrone Slothrop on 10/30/27 11:28

On Wed, 5 Oct 2005 22:53:01 +0200, "Maarten" <rijt@dse.nl> wrote:

>I've got the following problem.
>
>In a text field people can give their last name.
>With this input an pdf file is created.
>This works fine until a user has an space or an special character in their
>lastname like '.
>
>I would like to do the following:
>if a lastname contains other characters than normal letters replace them
>with an underscore.
>How can I do that?
>
>Maarten

You need a regular expression.

preg_replace ("/[^a-zA-Z]/e", "_", $string);

 

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

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