Regular Expressions 101

Community Patterns

Match a specific CSV field.

2

Regular Expression
PCRE (PHP <7.3)

/
^(([^";\n]*|"[^"\n]*");){4}([^";\n]*|"[^"\n]*");
/

Description

Fields terminated by ';' even if the fields are surrounded by " does not accept newlines. Change the central qualifier to get the column. if you want the Xth field write X-1 and use the 3° mathing group OR write X and use the 2° match.

Submitted by anonymous - 8 years ago