Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
((?<!\\)"(?:[^"]|(?:\\"))+(?<!\\)"|[^\s"]+)
/
g

Description

splits into command arguments:

  • spaces split
  • quotes keep spaced texts together
  • " escapes the quote
Submitted by Skycoder42 - 9 years ago