[ create a new paste ] login | about

Link: http://codepad.org/GKMxdMbT    [ raw code | output | fork ]

PHP, pasted on Jun 19:
1
2
3
4
5
<?php

$testString = '1.1 That big array of 2.1 data which is separated by 2.3 some text';
$testChunks = preg_split('/\s*(\d+\.\d+)\s*/', $testString, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
print_r($testChunks);


Output:
1
2
3
4
5
6
7
8
9
Array
(
    [0] => 1.1
    [1] => That big array of
    [2] => 2.1
    [3] => data which is separated by
    [4] => 2.3
    [5] => some text
)


Create a new paste based on this one


Comments: