Regular Expressions 101

Community Patterns

1...56789...901

Community Library Entry

29

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