Test, validate and match regular expressions
Parses search query strings into individual tokens with optional include/exclude modifiers (+ or -), handling double-quoted phrases, single-quoted phrases, and plain unquoted terms. Each alternative captures the quote character (empty group for unquoted terms) and the term text in separate groups, letting code distinguish exact-match phrases from keywords. Typically used with preg_match_all in PHP to build search filters, e.g. parsing '-exclude "exact phrase" plain'.