By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,615 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,615 IT Pros & Developers. It's quick & easy.

Separating Data

P: n/a
I am getting data lines with data separated by these 5 characters:

, : ; <TAB> <whitespace>

eg. foo,bar:baz foobar

I would like to extract foo bar baz nad foobar.

How can I parse out the data between or separated by them?

Thanks!
Jun 24 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
J Huntley Palmer wrote:
I am getting data lines with data separated by these 5 characters:

, : ; <TAB> <whitespace>

eg. foo,bar:baz foobar

I would like to extract foo bar baz nad foobar.

How can I parse out the data between or separated by them?

Thanks!

$array = preg_split("[,;:\t ]", $string, -1, PREG_SPLIT_NO_EMPTY);

The last argument takes care of consecutive delimiters.

See URL: http://php.benscom.com/manual/en/fun...preg-split.php
Jun 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.