Regular Expressions 101

Google like regex

Open Workspace
  • JavaScript
  • Match
36

Regular Expression

/
([+-]?(?:'.+?'|".+?"|[^+\- ]{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