<?php
$linhas = "
city=A(100,80);
city=B(160,70);
city=C(110,50);
city=D(140,120);
city=F(155,40);
city=G(210,60);
city=H(190,10);
city=I(170,110);
route=A-C;140;
route=A-D;155;
route=C-F;125;
route=D-B;115;
route=D-I;152;
route=B-F;119;
route=B-G;136;
route=G-F;133;
route=F-H;163;
route=I-H;197;";
preg_match_all("~(?:city|route)=(\w+)(?:\(|\-)(\w+)(?:\,|\;)(\w+)~", $linhas, $pontos);
echo "<pre>";
PD9waHAKCiRsaW5oYXMgPSAiCmNpdHk9QSgxMDAsODApOwpjaXR5PUIoMTYwLDcwKTsKY2l0eT1DKDExMCw1MCk7CmNpdHk9RCgxNDAsMTIwKTsKY2l0eT1GKDE1NSw0MCk7CmNpdHk9RygyMTAsNjApOwpjaXR5PUgoMTkwLDEwKTsKY2l0eT1JKDE3MCwxMTApOwpyb3V0ZT1BLUM7MTQwOwpyb3V0ZT1BLUQ7MTU1Owpyb3V0ZT1DLUY7MTI1Owpyb3V0ZT1ELUI7MTE1Owpyb3V0ZT1ELUk7MTUyOwpyb3V0ZT1CLUY7MTE5Owpyb3V0ZT1CLUc7MTM2Owpyb3V0ZT1HLUY7MTMzOwpyb3V0ZT1GLUg7MTYzOwpyb3V0ZT1JLUg7MTk3OyI7CgpwcmVnX21hdGNoX2FsbCgifig/OmNpdHl8cm91dGUpPShcdyspKD86XCh8XC0pKFx3KykoPzpcLHxcOykoXHcrKX4iLCAkbGluaGFzLCAkcG9udG9zKTsKCmVjaG8gIjxwcmU+IjsKcHJpbnRfcigkcG9udG9zKTsKCg==
<pre>Array
(
[0] => Array
(
[0] => city=A(100,80
[1] => city=B(160,70
[2] => city=C(110,50
[3] => city=D(140,120
[4] => city=F(155,40
[5] => city=G(210,60
[6] => city=H(190,10
[7] => city=I(170,110
[8] => route=A-C;140
[9] => route=A-D;155
[10] => route=C-F;125
[11] => route=D-B;115
[12] => route=D-I;152
[13] => route=B-F;119
[14] => route=B-G;136
[15] => route=G-F;133
[16] => route=F-H;163
[17] => route=I-H;197
)
[1] => Array
(
[0] => A
[1] => B
[2] => C
[3] => D
[4] => F
[5] => G
[6] => H
[7] => I
[8] => A
[9] => A
[10] => C
[11] => D
[12] => D
[13] => B
[14] => B
[15] => G
[16] => F
[17] => I
)
[2] => Array
(
[0] => 100
[1] => 160
[2] => 110
[3] => 140
[4] => 155
[5] => 210
[6] => 190
[7] => 170
[8] => C
[9] => D
[10] => F
[11] => B
[12] => I
[13] => F
[14] => G
[15] => F
[16] => H
[17] => H
)
[3] => Array
(
[0] => 80
[1] => 70
[2] => 50
[3] => 120
[4] => 40
[5] => 60
[6] => 10
[7] => 110
[8] => 140
[9] => 155
[10] => 125
[11] => 115
[12] => 152
[13] => 119
[14] => 136
[15] => 133
[16] => 163
[17] => 197
)
)