You are here: Re: split keywords into array « PHP Programming Language « IT news, forums, messages
Re: split keywords into array

Posted by Rik on 07/24/07 16:40

On Tue, 24 Jul 2007 18:11:53 +0200, Geoff Berrow <blthecat@ckdog.co.uk> =
=

wrote:

> Does anyone know what regular expression I would use to split text int=
o
> an array, assuming the text can be separated by any non alphanumeric
> character?

$array =3D preg_split('/\W+/',$string,-1,PREG_SPLIT_NO_EMPTY);

\W =3D non-word character

"A "word" character is any letter or digit or the underscore character, =
=

that is, any character which can be part of a Perl "word". The definitio=
n =

of letters and digits is controlled by PCRE's character tables, and may =
=

vary if locale-specific matching is taking place. For example, in the "f=
r" =

(French) locale, some character codes greater than 128 are used for =

accented letters, and these are matched by \w."

-- =

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

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