You are here: Re: pattern match and extract problem « PHP Programming Language « IT news, forums, messages
Re: pattern match and extract problem

Posted by Sean Barton on 02/08/06 00:47

easy enough. you can use a string tokeniser and use the ( as the
delimeter. it depends on how random the string will be to how you will
harvest the number.

for example:

$string = strtok($longstring,'(');

will give you:

20) and pears

then from then you can go...

$num1 = strtok($string,')');

$num1 would be 20.

its basic but would work.now its up to you how you work it you can run
more than one tokeniser at once so tokenise at the ' ' to get each word
or look into a function called explode()

i suppose to say that if the strings will be pretty regular then you
can use this and if not you would have to make it a little more dynamic


hope this helps

Sean Barton

 

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

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