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 Rik on 08/15/06 09:57

FFMG wrote:
> Mumia W. wrote:
>> On 08/15/2006 02:17 AM, FFMG wrote:
>>
>> Perhaps use, /a{0,10}1\b/
>>
>> The "\b" indicates a word boundary.
>>
>
> Sorry that will not work, for example,
>
> preg_replace( "/(a){0,10}(10)\b/", "######", "Aaaaa10B" )
>
> Does not work as 'B' is seen as part of the word.
> I need to tell regex that my word boundary is anything other than a
> digit, ([^0-9])

Well, why not tell it that then:
preg_replace('/(a){0,10}10{[^0-9]|$))/s',$string,'ccc$1');

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

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