You are here: Re: [PHP] Help with regex: breaking strings down to 'words' and 'phrases' « PHP « IT news, forums, messages
Re: [PHP] Help with regex: breaking strings down to 'words' and 'phrases'

Posted by Philip Hallstrom on 05/10/05 21:51

On Wed, 11 May 2005, Murray @ PlanetThoughtful wrote:

> Hi All,
>
> I'd very much appreciate some help building a regular expression for
> preg_match_all that can differentiate between 'words' and 'phrases'.
>
> For example, say I have a string that contains: 'this is an "example of a
> phrase"'
>
> I'd like to be able to break that down to:
>
> this
>
> is
>
> an
>
> example of a phrase
>

I haven't thought this through fully, but what if you exploded the string
on " into an array. Then loop through the array and for every even
element, explode on a space, otherwise just store the whole string into
the new array.

-philip

 

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

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