Regular Expressions 101

Community Patterns

Parse line of csv data

0

Regular Expression
PCRE (PHP <7.3)

/
(?:^|,)(?=[^\"]|(\")?)\"?((?(1)[^\"]*|[^,\"]*))\"?(?=,|$)
/
gm

Description

This regex will parse a line of csv data, capturing each field.

Submitted by anonymous - 3 years ago