Regular Expressions 101

Community Patterns

Community Library Entry

34

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 - 10 years ago