You are here: Re: preg_replace(...) looking for an exact number « All PHP « IT news, forums, messages
Re: preg_replace(...) looking for an exact number

Posted by FFMG on 08/15/06 08:15

Martin Larsen wrote:
> It sounds easy to make the regex, if I just could understand what you
> want :-)
>
> Please try to explain it again!

Sorry about that.

As an example lets say I want to replace the number "10" with "ten"
If I do preg_replace( "/10/", "ten", $text ) I run the risk of anything
containing the digits "10" been replaced.
For example "100" would become "ten0"

So I need to look for the number '10' alone, meaning that if it starts
or ends with a digit then it is another number. 109 would not qualify,
(because 9 is part of the number), but 10a would work as it is number
10 followed by 'a'.

FFMG

 

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

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