Regular Expressions 101

Community Patterns

Community Library Entry

35

Regular Expression
ECMAScript (JavaScript)

/
([+-]?(?:'.+?'|".+?"|[^+\- ]{1}[^ ]*))
/
g

Description

Attempts to mimic Google search box behavior, returning an array with the separated search strings (that keep the +/- indicator for following operations)

Submitted by mettjus - 11 years ago