[solved]preg_split more than 1 type delimiters

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
tomcatf14
Forum Newbie
Posts: 11
Joined: Wed Sep 05, 2007 3:33 pm

[solved]preg_split more than 1 type delimiters

Post 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
Last edited by tomcatf14 on Thu Sep 06, 2007 6:27 am, edited 1 time in total.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post 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
tomcatf14
Forum Newbie
Posts: 11
Joined: Wed Sep 05, 2007 3:33 pm

Post by tomcatf14 »

I used the other way. str_replace to replace the ":" with "." and run the preg_split as usual.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

/[,:]/
would suffice.
Post Reply