Page 1 of 1

Get a word list from a string

Posted: Wed Apr 07, 2004 3:46 pm
by scaryfast
Hey,

Im trying to obtain a list of words contained in a string, but I'm stuck!

Basically, I want something like an array, or comma delimited string with all the words separated, with no punctuation characters.

Im rubbish with preg and stuff like that, so any help would be brilliant...

Many thanks. :D

Posted: Wed Apr 07, 2004 4:42 pm
by feyd

Code: Select all

preg_split("/[^\w]+/",$string);
...should do it, I think.