Regular Expressions 101

Split quotes and single words

Open Workspace
  • JavaScript
  • Match
7

Regular Expression

/
"([^"\\]*(?:\\.[^"\\]*)*)"|\w+|'([^'\\]*(?:\\.[^'\\]*)*)'
/
g

Description

Find " and ' quoted strings and "orphaned"/single words in a string

Submitted by LoveIsGrief