Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Created·2016-03-31 04:27
Flavor·PCRE (Legacy)

/
(^[^;]+)(.*)(?:;)(.*$)?
/
gm
Open regex in editor

Description

This regex gets the first, the last and the middle part as capturing groups and matches the trailing semicolon as a non-capturing group. This allows you to resort CSV columns.

Submitted by Unkulunkulu