I want read a text file as C++ read it
here is example from the text file
(item(name 256) (desc 520)(Index 1)(Image \"Wea001\") (specialty (aspeed 700))
<?php
$txt = '(item(name 256) (desc 520)(Index 1)(Image "Wea001") (specialty (aspeed 700))(item (name 257) (desc 520) (Index 2) (Image "Wea002")(specialty(Attack 16 24)))';
preg_match_all('/name\s+(?P<name>\w+).*desc\s+(?P<desc>\d+).*Index\s+(?P<index>\d+).*Image\s+(?P<img>.*)\).*specialty\s*\((?P<speciality>.*)\)\)\)/', $txt, $matches);
foreach($matches['name'] AS $id => $name){
echo 'name : '.$name.' <br> Desc : '.$matches['desc'][$id].'<br> Index : '.$matches['index'][$id].'<br> speciality : '.$matches['speciality'][$id].'';
}
Assuming you have always similar data format