[ create a new paste ] login | about

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

PHP, pasted on Apr 16:
1
2
3
4
5
<?php

$string = "Hi, my name is Bob. I m 19yo and 170cm tall";

print_r(preg_split("/(,?\s+)|(\w\d)|(\d\w)/", $string));


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Array
(
    [0] => Hi
    [1] => my
    [2] => name
    [3] => is
    [4] => Bob.
    [5] => I
    [6] => m
    [7] => 
    [8] => yo
    [9] => and
    [10] => 
    [11] => 
    [12] => m
    [13] => tall
)


Create a new paste based on this one


Comments: