Regular Expressions 101

Community Patterns

Replace all occurences of a caracter except if placed between "

1

Regular Expression
PCRE2 (PHP >=7.3)

/
;(?=(?:[^"]*"[^"]*")*[^"]*$)
/
g

Description

Replace all occurences of the caracter ; except if it placed between two " signs.

Submitted by ccroche helped by ChatGPT - 3 months ago