$re = '~(.*?) => (\d+)(?: *\R|$)~s';
$str = '0 => 129367
1 => 998023
2 => 971513
3 => 365366
4 => 247647
5 => 131747
6 => 86151
7 => 898342
8 => 591121
9 => 828966
a => 185363
b => 420016
c => 472728
d => 185475
e => 669058
f => 472944
g => 932915
h => 109171
i => 940561
j => 483250
k => 240419
l => 158223
m => 494635
n => 205943
o => 19961
p => 989725
q => 125777
r => 195604
s => 818227
t => 83779
u => 990539
v => 639213
w => 669743
x => 546240
y => 950155
z => 631005
A => 126161
B => 403898
C => 323151
D => 536228
E => 653494
F => 810236
G => 808261
H => 900915
I => 60916
J => 417663
K => 371534
L => 384244
M => 900004
N => 300998
O => 346538
P => 5044
Q => 558707
R => 404479
S => 183163
T => 505254
U => 497969
V => 197795
W => 953877
X => 394637
Y => 760236
Z => 211436
! => 601326
" => 15745
# => 428427
$ => 602548
% => 938126
& => 159405
\' => 528113
( => 8021
) => 910309
* => 747795
+ => 232242
, => 731593
- => 808534
. => 429705
/ => 916854
: => 241543
; => 755104
< => 314595
= => 398161
> => 606925
? => 804662
@ => 713498
[ => 431477
\\ => 80381
] => 36645
^ => 156790
_ => 34787
` => 107682
{ => 283663
| => 650856
} => 91921
~ => 752056
=> 494223
=> 521932
=> 816279
=> 301703
=> 17163
=> 867641
ą => 817209
ś => 594615
ż => 570356
ź => 913303
ł => 752084
ó => 838178
ę => 693877
ń => 564418
ć => 30975
Ż => 707466';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php