preg_split() - pattern problem
| From: | Tobias Talltorp | Date: | Mon, 11 Nov 2002 18:26:11 +0000 |
| Subject: | preg_split() - pattern problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-123850@lists.php.net to get a copy of this message | ||
How would I write the pattern for this preg_split()?
"/T.*O.*B/", seems to only return the first and last portion of the string
(1: Once upon a time, 2: going for a walk).
$string = "Once upon a time T:O.B there was a T.O,B duck who was T-O'B going
for a walk";
$array = preg_split('/T.*O.*B/', $string, -1, PREG_SPLIT_OFFSET_CAPTURE);
for ($i=0; $i<sizeof($array); $i++) {
echo $array[$i]."<br>";
}
Any thoughts?
// Tobias