Regular Expressions 101

Community Patterns

Split quotes and single words

6

Regular Expression
ECMAScript (JavaScript)

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

Description

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

Submitted by LoveIsGrief - 10 years ago