How can I read and parse the contents of this text file?

前端 未结 1 1464
滥情空心
滥情空心 2021-01-22 16:01

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))         


        
1条回答
  •  旧时难觅i
    2021-01-22 16:32

    \w+).*desc\s+(?P\d+).*Index\s+(?P\d+).*Image\s+(?P.*)\).*specialty\s*\((?P.*)\)\)\)/', $txt, $matches);
      foreach($matches['name'] AS $id => $name){
           echo 'name : '.$name.' 
    Desc : '.$matches['desc'][$id].'
    Index : '.$matches['index'][$id].'
    speciality : '.$matches['speciality'][$id].''; }

    Assuming you have always similar data format

    0 讨论(0)
提交回复
热议问题