You are here: Re: Simple Regular Expression ? « All PHP « IT news, forums, messages
Re: Simple Regular Expression ?

Posted by Rik on 10/02/25 11:51

McHenry wrote:
>> With listed as 'POA' you mean it literally?
>> If you're using the simple one:
>>
>> <h3>.*?(?:(?P<prices>(?:[0-9]+[0-9\.,]*)|POA).*?){1,3}</h3>
> Rik, thanks as always. POA was simply an example it could be anything.
> What I meant was if the one regex performs three caputres in the one
> statement and one fails must all three fail or can the other two still
> capture ?

<h3>.*?(?:(?P<prices>[0-9]+[0-9\.,]*).*?){0,3}</h3>

Will search for max three prices, will allow none.

<h3>.*?(?:(?P<prices>[0-9]+[0-9\.,]*).*?){1,3}</h3>

Will search for max three prices, will allow at least one.

<h3>.*?(?:(?P<prices>[0-9]+[0-9\.,]*).*?)+?</h3>

Will search for as many prices as there are, will allow at least one.

<h3>.*?(?:(?P<prices>[0-9]+[0-9\.,]*).*?)*?</h3>

Will search for as many prices as there are, will allow none.

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

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