Page 1 of 1

[solved]preg_split more than 1 type delimiters

Posted: Thu Sep 06, 2007 6:02 am
by tomcatf14

Code: Select all

$splitdata = preg_split ("/,/","/:/" $lineVar1);
How do i tell preg_split to split the data is a string if there is more than one type of delimiters?Letz say a "." and ":" at the same string.

------------------------
How, are, you, today: Bob

Posted: Thu Sep 06, 2007 6:15 am
by CoderGoblin
I am by no means a preg expression expert but.. the | bar is used as an OR. Examples can be found on Preg Pattern Syntax

Posted: Thu Sep 06, 2007 6:27 am
by tomcatf14
I used the other way. str_replace to replace the ":" with "." and run the preg_split as usual.

Posted: Thu Sep 06, 2007 8:00 am
by feyd

Code: Select all

/[,:]/
would suffice.