<?php $s = "SW1A 1AA";preg_match_all('~[a-zA-Z]+|\d+|[^\da-zA-Z]+~', $s, $chunks);print_r($chunks[0]);
Standard input is empty
Array ( [0] => SW [1] => 1 [2] => A [3] => [4] => 1 [5] => AA )
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!