Regular expression to match CSV delimiters

后端 未结 6 962
天命终不由人
天命终不由人 2020-12-17 22:39

I\'m trying to create a PCRE that will match only the commas used as delimiters in a line from a CSV file. Assuming the format of a line is this:

1,\"abcd\",         


        
6条回答
  •  隐瞒了意图╮
    2020-12-17 23:11

    Without thinking to hard, I would do something like [0-9]+|"[^"]*" to match everything except the comma delimiters. Would that do the trick?

    Without context it's impossible to give a more specific solution.

提交回复
热议问题