Regular Expressions 101

Community Patterns

Community Library Entry

28

Regular Expression
PCRE (PHP <7.3)

/
(?:\s*(?:\"([^\"]*)\"|([^,]+))\s*,?)+?
/
g

Description

Captures all fields from a CSV file's line. Can be customized with user-defined field separator and protecting character.

Submitted by Various - 10 years ago