Regular expression for parsing CSV in PHP

前端 未结 6 2209
离开以前
离开以前 2020-12-10 06:58

I already managed to split the CSV file using this regex: \"/,(?=(?:[^\\\"]\\\"[^\\\"]\\\")(?![^\\\"]\\\"))/\"

But I ended up with an array of stri

6条回答
  •  隐瞒了意图╮
    2020-12-10 07:18

    Here's my quick attempt at it, although it will only work on word boundaries.

    preg_replace('/([\W]){2}\b/', '\1', $csv)
    

提交回复
热议问题