Regular Expressions 101

Save & Manage Regex

  • Current Version: 3
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
Sponsors
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Character class intersection
    [\w&&[^\d]]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
Processing...

Test String

Code Generator

Generated Code

const regex = /car (zap(?: zap)?|zap(?: yes)?|zap(?: xerox)?|zap(?: with)?|zap(?: view)?|zap(?: under)?|zap(?: this)?|zap(?: sort)?|zap(?: rest)?|zap(?: quick)?|zap(?: pie)?|zap(?: orange)?|zap(?: nope)?|zap(?: meal)?|zap(?: letter)?|zap(?: kayak)?|zap(?: joseph)?|zap(?: indiana)?|zap(?: humus)?|zap(?: gelatin)?|zap(?: frankfurter)?|zap(?: elephant)?|zap(?: doormat)?|zap(?: carrot)?|zap(?: banana)?|zap(?: apple)?|yes(?: zap)?|yes(?: yes)?|yes(?: xerox)?|yes(?: with)?|yes(?: view)?|yes(?: under)?|yes(?: this)?|yes(?: sort)?|yes(?: rest)?|yes(?: quick)?|yes(?: pie)?|yes(?: orange)?|yes(?: nope)?|yes(?: meal)?|yes(?: letter)?|yes(?: kayak)?|yes(?: joseph)?|yes(?: indiana)?|yes(?: humus)?|yes(?: gelatin)?|yes(?: frankfurter)?|yes(?: elephant)?|yes(?: doormat)?|yes(?: carrot)?|yes(?: banana)?|yes(?: apple)?|xerox(?: zap)?|xerox(?: yes)?|xerox(?: xerox)?|xerox(?: with)?|xerox(?: view)?|xerox(?: under)?|xerox(?: this)?|xerox(?: sort)?|xerox(?: rest)?|xerox(?: quick)?|xerox(?: pie)?|xerox(?: orange)?|xerox(?: nope)?|xerox(?: meal)?|xerox(?: letter)?|xerox(?: kayak)?|xerox(?: joseph)?|xerox(?: indiana)?|xerox(?: humus)?|xerox(?: gelatin)?|xerox(?: frankfurter)?|xerox(?: elephant)?|xerox(?: doormat)?|xerox(?: carrot)?|xerox(?: banana)?|xerox(?: apple)?|with(?: zap)?|with(?: yes)?|with(?: xerox)?|with(?: with)?|with(?: view)?|with(?: under)?|with(?: this)?|with(?: sort)?|with(?: rest)?|with(?: quick)?|with(?: pie)?|with(?: orange)?|with(?: nope)?|with(?: meal)?|with(?: letter)?|with(?: kayak)?|with(?: joseph)?|with(?: indiana)?|with(?: humus)?|with(?: gelatin)?|with(?: frankfurter)?|with(?: elephant)?|with(?: doormat)?|with(?: carrot)?|with(?: banana)?|with(?: apple)?|view(?: zap)?|view(?: yes)?|view(?: xerox)?|view(?: with)?|view(?: view)?|view(?: under)?|view(?: this)?|view(?: sort)?|view(?: rest)?|view(?: quick)?|view(?: pie)?|view(?: orange)?|view(?: nope)?|view(?: meal)?|view(?: letter)?|view(?: kayak)?|view(?: joseph)?|view(?: indiana)?|view(?: humus)?|view(?: gelatin)?|view(?: frankfurter)?|view(?: elephant)?|view(?: doormat)?|view(?: carrot)?|view(?: banana)?|view(?: apple)?|under(?: zap)?|under(?: yes)?|under(?: xerox)?|under(?: with)?|under(?: view)?|under(?: under)?|under(?: this)?|under(?: sort)?|under(?: rest)?|under(?: quick)?|under(?: pie)?|under(?: orange)?|under(?: nope)?|under(?: meal)?|under(?: letter)?|under(?: kayak)?|under(?: joseph)?|under(?: indiana)?|under(?: humus)?|under(?: gelatin)?|under(?: frankfurter)?|under(?: elephant)?|under(?: doormat)?|under(?: carrot)?|under(?: banana)?|under(?: apple)?|this(?: zap)?|this(?: yes)?|this(?: xerox)?|this(?: with)?|this(?: view)?|this(?: under)?|this(?: this)?|this(?: sort)?|this(?: rest)?|this(?: quick)?|this(?: pie)?|this(?: orange)?|this(?: nope)?|this(?: meal)?|this(?: letter)?|this(?: kayak)?|this(?: joseph)?|this(?: indiana)?|this(?: humus)?|this(?: gelatin)?|this(?: frankfurter)?|this(?: elephant)?|this(?: doormat)?|this(?: carrot)?|this(?: banana)?|this(?: apple)?|sort(?: zap)?|sort(?: yes)?|sort(?: xerox)?|sort(?: with)?|sort(?: view)?|sort(?: under)?|sort(?: this)?|sort(?: sort)?|sort(?: rest)?|sort(?: quick)?|sort(?: pie)?|sort(?: orange)?|sort(?: nope)?|sort(?: meal)?|sort(?: letter)?|sort(?: kayak)?|sort(?: joseph)?|sort(?: indiana)?|sort(?: humus)?|sort(?: gelatin)?|sort(?: frankfurter)?|sort(?: elephant)?|sort(?: doormat)?|sort(?: carrot)?|sort(?: banana)?|sort(?: apple)?|rest(?: zap)?|rest(?: yes)?|rest(?: xerox)?|rest(?: with)?|rest(?: view)?|rest(?: under)?|rest(?: this)?|rest(?: sort)?|rest(?: rest)?|rest(?: quick)?|rest(?: pie)?|rest(?: orange)?|rest(?: nope)?|rest(?: meal)?|rest(?: letter)?|rest(?: kayak)?|rest(?: joseph)?|rest(?: indiana)?|rest(?: humus)?|rest(?: gelatin)?|rest(?: frankfurter)?|rest(?: elephant)?|rest(?: doormat)?|rest(?: carrot)?|rest(?: banana)?|rest(?: apple)?|quick(?: zap)?|quick(?: yes)?|quick(?: xerox)?|quick(?: with)?|quick(?: view)?|quick(?: under)?|quick(?: this)?|quick(?: sort)?|quick(?: rest)?|quick(?: quick)?|quick(?: pie)?|quick(?: orange)?|quick(?: nope)?|quick(?: meal)?|quick(?: letter)?|quick(?: kayak)?|quick(?: joseph)?|quick(?: indiana)?|quick(?: humus)?|quick(?: gelatin)?|quick(?: frankfurter)?|quick(?: elephant)?|quick(?: doormat)?|quick(?: carrot)?|quick(?: banana)?|quick(?: apple)?|pie(?: zap)?|pie(?: yes)?|pie(?: xerox)?|pie(?: with)?|pie(?: view)?|pie(?: under)?|pie(?: this)?|pie(?: sort)?|pie(?: rest)?|pie(?: quick)?|pie(?: pie)?|pie(?: orange)?|pie(?: nope)?|pie(?: meal)?|pie(?: letter)?|pie(?: kayak)?|pie(?: joseph)?|pie(?: indiana)?|pie(?: humus)?|pie(?: gelatin)?|pie(?: frankfurter)?|pie(?: elephant)?|pie(?: doormat)?|pie(?: carrot)?|pie(?: banana)?|pie(?: apple)?|orange(?: zap)?|orange(?: yes)?|orange(?: xerox)?|orange(?: with)?|orange(?: view)?|orange(?: under)?|orange(?: this)?|orange(?: sort)?|orange(?: rest)?|orange(?: quick)?|orange(?: pie)?|orange(?: orange)?|orange(?: nope)?|orange(?: meal)?|orange(?: letter)?|orange(?: kayak)?|orange(?: joseph)?|orange(?: indiana)?|orange(?: humus)?|orange(?: gelatin)?|orange(?: frankfurter)?|orange(?: elephant)?|orange(?: doormat)?|orange(?: carrot)?|orange(?: banana)?|orange(?: apple)?|nope(?: zap)?|nope(?: yes)?|nope(?: xerox)?|nope(?: with)?|nope(?: view)?|nope(?: under)?|nope(?: this)?|nope(?: sort)?|nope(?: rest)?|nope(?: quick)?|nope(?: pie)?|nope(?: orange)?|nope(?: nope)?|nope(?: meal)?|nope(?: letter)?|nope(?: kayak)?|nope(?: joseph)?|nope(?: indiana)?|nope(?: humus)?|nope(?: gelatin)?|nope(?: frankfurter)?|nope(?: elephant)?|nope(?: doormat)?|nope(?: carrot)?|nope(?: banana)?|nope(?: apple)?|meal(?: zap)?|meal(?: yes)?|meal(?: xerox)?|meal(?: with)?|meal(?: view)?|meal(?: under)?|meal(?: this)?|meal(?: sort)?|meal(?: rest)?|meal(?: quick)?|meal(?: pie)?|meal(?: orange)?|meal(?: nope)?|meal(?: meal)?|meal(?: letter)?|meal(?: kayak)?|meal(?: joseph)?|meal(?: indiana)?|meal(?: humus)?|meal(?: gelatin)?|meal(?: frankfurter)?|meal(?: elephant)?|meal(?: doormat)?|meal(?: carrot)?|meal(?: banana)?|meal(?: apple)?|letter(?: zap)?|letter(?: yes)?|letter(?: xerox)?|letter(?: with)?|letter(?: view)?|letter(?: under)?|letter(?: this)?|letter(?: sort)?|letter(?: rest)?|letter(?: quick)?|letter(?: pie)?|letter(?: orange)?|letter(?: nope)?|letter(?: meal)?|letter(?: letter)?|letter(?: kayak)?|letter(?: joseph)?|letter(?: indiana)?|letter(?: humus)?|letter(?: gelatin)?|letter(?: frankfurter)?|letter(?: elephant)?|letter(?: doormat)?|letter(?: carrot)?|letter(?: banana)?|letter(?: apple)?|kayak(?: zap)?|kayak(?: yes)?|kayak(?: xerox)?|kayak(?: with)?|kayak(?: view)?|kayak(?: under)?|kayak(?: this)?|kayak(?: sort)?|kayak(?: rest)?|kayak(?: quick)?|kayak(?: pie)?|kayak(?: orange)?|kayak(?: nope)?|kayak(?: meal)?|kayak(?: letter)?|kayak(?: kayak)?|kayak(?: joseph)?|kayak(?: indiana)?|kayak(?: humus)?|kayak(?: gelatin)?|kayak(?: frankfurter)?|kayak(?: elephant)?|kayak(?: doormat)?|kayak(?: carrot)?|kayak(?: banana)?|kayak(?: apple)?|joseph(?: zap)?|joseph(?: yes)?|joseph(?: xerox)?|joseph(?: with)?|joseph(?: view)?|joseph(?: under)?|joseph(?: this)?|joseph(?: sort)?|joseph(?: rest)?|joseph(?: quick)?|joseph(?: pie)?|joseph(?: orange)?|joseph(?: nope)?|joseph(?: meal)?|joseph(?: letter)?|joseph(?: kayak)?|joseph(?: joseph)?|joseph(?: indiana)?|joseph(?: humus)?|joseph(?: gelatin)?|joseph(?: frankfurter)?|joseph(?: elephant)?|joseph(?: doormat)?|joseph(?: carrot)?|joseph(?: banana)?|joseph(?: apple)?|indiana(?: zap)?|indiana(?: yes)?|indiana(?: xerox)?|indiana(?: with)?|indiana(?: view)?|indiana(?: under)?|indiana(?: this)?|indiana(?: sort)?|indiana(?: rest)?|indiana(?: quick)?|indiana(?: pie)?|indiana(?: orange)?|indiana(?: nope)?|indiana(?: meal)?|indiana(?: letter)?|indiana(?: kayak)?|indiana(?: joseph)?|indiana(?: indiana)?|indiana(?: humus)?|indiana(?: gelatin)?|indiana(?: frankfurter)?|indiana(?: elephant)?|indiana(?: doormat)?|indiana(?: carrot)?|indiana(?: banana)?|indiana(?: apple)?|humus(?: zap)?|humus(?: yes)?|humus(?: xerox)?|humus(?: with)?|humus(?: view)?|humus(?: under)?|humus(?: this)?|humus(?: sort)?|humus(?: rest)?|humus(?: quick)?|humus(?: pie)?|humus(?: orange)?|humus(?: nope)?|humus(?: meal)?|humus(?: letter)?|humus(?: kayak)?|humus(?: joseph)?|humus(?: indiana)?|humus(?: humus)?|humus(?: gelatin)?|humus(?: frankfurter)?|humus(?: elephant)?|humus(?: doormat)?|humus(?: carrot)?|humus(?: banana)?|humus(?: apple)?|gelatin(?: zap)?|gelatin(?: yes)?|gelatin(?: xerox)?|gelatin(?: with)?|gelatin(?: view)?|gelatin(?: under)?|gelatin(?: this)?|gelatin(?: sort)?|gelatin(?: rest)?|gelatin(?: quick)?|gelatin(?: pie)?|gelatin(?: orange)?|gelatin(?: nope)?|gelatin(?: meal)?|gelatin(?: letter)?|gelatin(?: kayak)?|gelatin(?: joseph)?|gelatin(?: indiana)?|gelatin(?: humus)?|gelatin(?: gelatin)?|gelatin(?: frankfurter)?|gelatin(?: elephant)?|gelatin(?: doormat)?|gelatin(?: carrot)?|gelatin(?: banana)?|gelatin(?: apple)?|frankfurter(?: zap)?|frankfurter(?: yes)?|frankfurter(?: xerox)?|frankfurter(?: with)?|frankfurter(?: view)?|frankfurter(?: under)?|frankfurter(?: this)?|frankfurter(?: sort)?|frankfurter(?: rest)?|frankfurter(?: quick)?|frankfurter(?: pie)?|frankfurter(?: orange)?|frankfurter(?: nope)?|frankfurter(?: meal)?|frankfurter(?: letter)?|frankfurter(?: kayak)?|frankfurter(?: joseph)?|frankfurter(?: indiana)?|frankfurter(?: humus)?|frankfurter(?: gelatin)?|frankfurter(?: frankfurter)?|frankfurter(?: elephant)?|frankfurter(?: doormat)?|frankfurter(?: carrot)?|frankfurter(?: banana)?|frankfurter(?: apple)?|elephant(?: zap)?|elephant(?: yes)?|elephant(?: xerox)?|elephant(?: with)?|elephant(?: view)?|elephant(?: under)?|elephant(?: this)?|elephant(?: sort)?|elephant(?: rest)?|elephant(?: quick)?|elephant(?: pie)?|elephant(?: orange)?|elephant(?: nope)?|elephant(?: meal)?|elephant(?: letter)?|elephant(?: kayak)?|elephant(?: joseph)?|elephant(?: indiana)?|elephant(?: humus)?|elephant(?: gelatin)?|elephant(?: frankfurter)?|elephant(?: elephant)?|elephant(?: doormat)?|elephant(?: carrot)?|elephant(?: banana)?|elephant(?: apple)?|doormat(?: zap)?|doormat(?: yes)?|doormat(?: xerox)?|doormat(?: with)?|doormat(?: view)?|doormat(?: under)?|doormat(?: this)?|doormat(?: sort)?|doormat(?: rest)?|doormat(?: quick)?|doormat(?: pie)?|doormat(?: orange)?|doormat(?: nope)?|doormat(?: meal)?|doormat(?: letter)?|doormat(?: kayak)?|doormat(?: joseph)?|doormat(?: indiana)?|doormat(?: humus)?|doormat(?: gelatin)?|doormat(?: frankfurter)?|doormat(?: elephant)?|doormat(?: doormat)?|doormat(?: carrot)?|doormat(?: banana)?|doormat(?: apple)?|carrot(?: zap)?|carrot(?: yes)?|carrot(?: xerox)?|carrot(?: with)?|carrot(?: view)?|carrot(?: under)?|carrot(?: this)?|carrot(?: sort)?|carrot(?: rest)?|carrot(?: quick)?|carrot(?: pie)?|carrot(?: orange)?|carrot(?: nope)?|carrot(?: meal)?|carrot(?: letter)?|carrot(?: kayak)?|carrot(?: joseph)?|carrot(?: indiana)?|carrot(?: humus)?|carrot(?: gelatin)?|carrot(?: frankfurter)?|carrot(?: elephant)?|carrot(?: doormat)?|carrot(?: carrot)?|carrot(?: banana)?|carrot(?: apple)?|banana(?: zap)?|banana(?: yes)?|banana(?: xerox)?|banana(?: with)?|banana(?: view)?|banana(?: under)?|banana(?: this)?|banana(?: sort)?|banana(?: rest)?|banana(?: quick)?|banana(?: pie)?|banana(?: orange)?|banana(?: nope)?|banana(?: meal)?|banana(?: letter)?|banana(?: kayak)?|banana(?: joseph)?|banana(?: indiana)?|banana(?: humus)?|banana(?: gelatin)?|banana(?: frankfurter)?|banana(?: elephant)?|banana(?: doormat)?|banana(?: carrot)?|banana(?: banana)?|banana(?: apple)?|apple(?: zap)?|apple(?: yes)?|apple(?: xerox)?|apple(?: with)?|apple(?: view)?|apple(?: under)?|apple(?: this)?|apple(?: sort)?|apple(?: rest)?|apple(?: quick)?|apple(?: pie)?|apple(?: orange)?|apple(?: nope)?|apple(?: meal)?|apple(?: letter)?|apple(?: kayak)?|apple(?: joseph)?|apple(?: indiana)?|apple(?: humus)?|apple(?: gelatin)?|apple(?: frankfurter)?|apple(?: elephant)?|apple(?: doormat)?|apple(?: carrot)?|apple(?: banana)?|apple(?: apple)?) crashed/g; // Alternative syntax using RegExp constructor // const regex = new RegExp('car (zap(?: zap)?|zap(?: yes)?|zap(?: xerox)?|zap(?: with)?|zap(?: view)?|zap(?: under)?|zap(?: this)?|zap(?: sort)?|zap(?: rest)?|zap(?: quick)?|zap(?: pie)?|zap(?: orange)?|zap(?: nope)?|zap(?: meal)?|zap(?: letter)?|zap(?: kayak)?|zap(?: joseph)?|zap(?: indiana)?|zap(?: humus)?|zap(?: gelatin)?|zap(?: frankfurter)?|zap(?: elephant)?|zap(?: doormat)?|zap(?: carrot)?|zap(?: banana)?|zap(?: apple)?|yes(?: zap)?|yes(?: yes)?|yes(?: xerox)?|yes(?: with)?|yes(?: view)?|yes(?: under)?|yes(?: this)?|yes(?: sort)?|yes(?: rest)?|yes(?: quick)?|yes(?: pie)?|yes(?: orange)?|yes(?: nope)?|yes(?: meal)?|yes(?: letter)?|yes(?: kayak)?|yes(?: joseph)?|yes(?: indiana)?|yes(?: humus)?|yes(?: gelatin)?|yes(?: frankfurter)?|yes(?: elephant)?|yes(?: doormat)?|yes(?: carrot)?|yes(?: banana)?|yes(?: apple)?|xerox(?: zap)?|xerox(?: yes)?|xerox(?: xerox)?|xerox(?: with)?|xerox(?: view)?|xerox(?: under)?|xerox(?: this)?|xerox(?: sort)?|xerox(?: rest)?|xerox(?: quick)?|xerox(?: pie)?|xerox(?: orange)?|xerox(?: nope)?|xerox(?: meal)?|xerox(?: letter)?|xerox(?: kayak)?|xerox(?: joseph)?|xerox(?: indiana)?|xerox(?: humus)?|xerox(?: gelatin)?|xerox(?: frankfurter)?|xerox(?: elephant)?|xerox(?: doormat)?|xerox(?: carrot)?|xerox(?: banana)?|xerox(?: apple)?|with(?: zap)?|with(?: yes)?|with(?: xerox)?|with(?: with)?|with(?: view)?|with(?: under)?|with(?: this)?|with(?: sort)?|with(?: rest)?|with(?: quick)?|with(?: pie)?|with(?: orange)?|with(?: nope)?|with(?: meal)?|with(?: letter)?|with(?: kayak)?|with(?: joseph)?|with(?: indiana)?|with(?: humus)?|with(?: gelatin)?|with(?: frankfurter)?|with(?: elephant)?|with(?: doormat)?|with(?: carrot)?|with(?: banana)?|with(?: apple)?|view(?: zap)?|view(?: yes)?|view(?: xerox)?|view(?: with)?|view(?: view)?|view(?: under)?|view(?: this)?|view(?: sort)?|view(?: rest)?|view(?: quick)?|view(?: pie)?|view(?: orange)?|view(?: nope)?|view(?: meal)?|view(?: letter)?|view(?: kayak)?|view(?: joseph)?|view(?: indiana)?|view(?: humus)?|view(?: gelatin)?|view(?: frankfurter)?|view(?: elephant)?|view(?: doormat)?|view(?: carrot)?|view(?: banana)?|view(?: apple)?|under(?: zap)?|under(?: yes)?|under(?: xerox)?|under(?: with)?|under(?: view)?|under(?: under)?|under(?: this)?|under(?: sort)?|under(?: rest)?|under(?: quick)?|under(?: pie)?|under(?: orange)?|under(?: nope)?|under(?: meal)?|under(?: letter)?|under(?: kayak)?|under(?: joseph)?|under(?: indiana)?|under(?: humus)?|under(?: gelatin)?|under(?: frankfurter)?|under(?: elephant)?|under(?: doormat)?|under(?: carrot)?|under(?: banana)?|under(?: apple)?|this(?: zap)?|this(?: yes)?|this(?: xerox)?|this(?: with)?|this(?: view)?|this(?: under)?|this(?: this)?|this(?: sort)?|this(?: rest)?|this(?: quick)?|this(?: pie)?|this(?: orange)?|this(?: nope)?|this(?: meal)?|this(?: letter)?|this(?: kayak)?|this(?: joseph)?|this(?: indiana)?|this(?: humus)?|this(?: gelatin)?|this(?: frankfurter)?|this(?: elephant)?|this(?: doormat)?|this(?: carrot)?|this(?: banana)?|this(?: apple)?|sort(?: zap)?|sort(?: yes)?|sort(?: xerox)?|sort(?: with)?|sort(?: view)?|sort(?: under)?|sort(?: this)?|sort(?: sort)?|sort(?: rest)?|sort(?: quick)?|sort(?: pie)?|sort(?: orange)?|sort(?: nope)?|sort(?: meal)?|sort(?: letter)?|sort(?: kayak)?|sort(?: joseph)?|sort(?: indiana)?|sort(?: humus)?|sort(?: gelatin)?|sort(?: frankfurter)?|sort(?: elephant)?|sort(?: doormat)?|sort(?: carrot)?|sort(?: banana)?|sort(?: apple)?|rest(?: zap)?|rest(?: yes)?|rest(?: xerox)?|rest(?: with)?|rest(?: view)?|rest(?: under)?|rest(?: this)?|rest(?: sort)?|rest(?: rest)?|rest(?: quick)?|rest(?: pie)?|rest(?: orange)?|rest(?: nope)?|rest(?: meal)?|rest(?: letter)?|rest(?: kayak)?|rest(?: joseph)?|rest(?: indiana)?|rest(?: humus)?|rest(?: gelatin)?|rest(?: frankfurter)?|rest(?: elephant)?|rest(?: doormat)?|rest(?: carrot)?|rest(?: banana)?|rest(?: apple)?|quick(?: zap)?|quick(?: yes)?|quick(?: xerox)?|quick(?: with)?|quick(?: view)?|quick(?: under)?|quick(?: this)?|quick(?: sort)?|quick(?: rest)?|quick(?: quick)?|quick(?: pie)?|quick(?: orange)?|quick(?: nope)?|quick(?: meal)?|quick(?: letter)?|quick(?: kayak)?|quick(?: joseph)?|quick(?: indiana)?|quick(?: humus)?|quick(?: gelatin)?|quick(?: frankfurter)?|quick(?: elephant)?|quick(?: doormat)?|quick(?: carrot)?|quick(?: banana)?|quick(?: apple)?|pie(?: zap)?|pie(?: yes)?|pie(?: xerox)?|pie(?: with)?|pie(?: view)?|pie(?: under)?|pie(?: this)?|pie(?: sort)?|pie(?: rest)?|pie(?: quick)?|pie(?: pie)?|pie(?: orange)?|pie(?: nope)?|pie(?: meal)?|pie(?: letter)?|pie(?: kayak)?|pie(?: joseph)?|pie(?: indiana)?|pie(?: humus)?|pie(?: gelatin)?|pie(?: frankfurter)?|pie(?: elephant)?|pie(?: doormat)?|pie(?: carrot)?|pie(?: banana)?|pie(?: apple)?|orange(?: zap)?|orange(?: yes)?|orange(?: xerox)?|orange(?: with)?|orange(?: view)?|orange(?: under)?|orange(?: this)?|orange(?: sort)?|orange(?: rest)?|orange(?: quick)?|orange(?: pie)?|orange(?: orange)?|orange(?: nope)?|orange(?: meal)?|orange(?: letter)?|orange(?: kayak)?|orange(?: joseph)?|orange(?: indiana)?|orange(?: humus)?|orange(?: gelatin)?|orange(?: frankfurter)?|orange(?: elephant)?|orange(?: doormat)?|orange(?: carrot)?|orange(?: banana)?|orange(?: apple)?|nope(?: zap)?|nope(?: yes)?|nope(?: xerox)?|nope(?: with)?|nope(?: view)?|nope(?: under)?|nope(?: this)?|nope(?: sort)?|nope(?: rest)?|nope(?: quick)?|nope(?: pie)?|nope(?: orange)?|nope(?: nope)?|nope(?: meal)?|nope(?: letter)?|nope(?: kayak)?|nope(?: joseph)?|nope(?: indiana)?|nope(?: humus)?|nope(?: gelatin)?|nope(?: frankfurter)?|nope(?: elephant)?|nope(?: doormat)?|nope(?: carrot)?|nope(?: banana)?|nope(?: apple)?|meal(?: zap)?|meal(?: yes)?|meal(?: xerox)?|meal(?: with)?|meal(?: view)?|meal(?: under)?|meal(?: this)?|meal(?: sort)?|meal(?: rest)?|meal(?: quick)?|meal(?: pie)?|meal(?: orange)?|meal(?: nope)?|meal(?: meal)?|meal(?: letter)?|meal(?: kayak)?|meal(?: joseph)?|meal(?: indiana)?|meal(?: humus)?|meal(?: gelatin)?|meal(?: frankfurter)?|meal(?: elephant)?|meal(?: doormat)?|meal(?: carrot)?|meal(?: banana)?|meal(?: apple)?|letter(?: zap)?|letter(?: yes)?|letter(?: xerox)?|letter(?: with)?|letter(?: view)?|letter(?: under)?|letter(?: this)?|letter(?: sort)?|letter(?: rest)?|letter(?: quick)?|letter(?: pie)?|letter(?: orange)?|letter(?: nope)?|letter(?: meal)?|letter(?: letter)?|letter(?: kayak)?|letter(?: joseph)?|letter(?: indiana)?|letter(?: humus)?|letter(?: gelatin)?|letter(?: frankfurter)?|letter(?: elephant)?|letter(?: doormat)?|letter(?: carrot)?|letter(?: banana)?|letter(?: apple)?|kayak(?: zap)?|kayak(?: yes)?|kayak(?: xerox)?|kayak(?: with)?|kayak(?: view)?|kayak(?: under)?|kayak(?: this)?|kayak(?: sort)?|kayak(?: rest)?|kayak(?: quick)?|kayak(?: pie)?|kayak(?: orange)?|kayak(?: nope)?|kayak(?: meal)?|kayak(?: letter)?|kayak(?: kayak)?|kayak(?: joseph)?|kayak(?: indiana)?|kayak(?: humus)?|kayak(?: gelatin)?|kayak(?: frankfurter)?|kayak(?: elephant)?|kayak(?: doormat)?|kayak(?: carrot)?|kayak(?: banana)?|kayak(?: apple)?|joseph(?: zap)?|joseph(?: yes)?|joseph(?: xerox)?|joseph(?: with)?|joseph(?: view)?|joseph(?: under)?|joseph(?: this)?|joseph(?: sort)?|joseph(?: rest)?|joseph(?: quick)?|joseph(?: pie)?|joseph(?: orange)?|joseph(?: nope)?|joseph(?: meal)?|joseph(?: letter)?|joseph(?: kayak)?|joseph(?: joseph)?|joseph(?: indiana)?|joseph(?: humus)?|joseph(?: gelatin)?|joseph(?: frankfurter)?|joseph(?: elephant)?|joseph(?: doormat)?|joseph(?: carrot)?|joseph(?: banana)?|joseph(?: apple)?|indiana(?: zap)?|indiana(?: yes)?|indiana(?: xerox)?|indiana(?: with)?|indiana(?: view)?|indiana(?: under)?|indiana(?: this)?|indiana(?: sort)?|indiana(?: rest)?|indiana(?: quick)?|indiana(?: pie)?|indiana(?: orange)?|indiana(?: nope)?|indiana(?: meal)?|indiana(?: letter)?|indiana(?: kayak)?|indiana(?: joseph)?|indiana(?: indiana)?|indiana(?: humus)?|indiana(?: gelatin)?|indiana(?: frankfurter)?|indiana(?: elephant)?|indiana(?: doormat)?|indiana(?: carrot)?|indiana(?: banana)?|indiana(?: apple)?|humus(?: zap)?|humus(?: yes)?|humus(?: xerox)?|humus(?: with)?|humus(?: view)?|humus(?: under)?|humus(?: this)?|humus(?: sort)?|humus(?: rest)?|humus(?: quick)?|humus(?: pie)?|humus(?: orange)?|humus(?: nope)?|humus(?: meal)?|humus(?: letter)?|humus(?: kayak)?|humus(?: joseph)?|humus(?: indiana)?|humus(?: humus)?|humus(?: gelatin)?|humus(?: frankfurter)?|humus(?: elephant)?|humus(?: doormat)?|humus(?: carrot)?|humus(?: banana)?|humus(?: apple)?|gelatin(?: zap)?|gelatin(?: yes)?|gelatin(?: xerox)?|gelatin(?: with)?|gelatin(?: view)?|gelatin(?: under)?|gelatin(?: this)?|gelatin(?: sort)?|gelatin(?: rest)?|gelatin(?: quick)?|gelatin(?: pie)?|gelatin(?: orange)?|gelatin(?: nope)?|gelatin(?: meal)?|gelatin(?: letter)?|gelatin(?: kayak)?|gelatin(?: joseph)?|gelatin(?: indiana)?|gelatin(?: humus)?|gelatin(?: gelatin)?|gelatin(?: frankfurter)?|gelatin(?: elephant)?|gelatin(?: doormat)?|gelatin(?: carrot)?|gelatin(?: banana)?|gelatin(?: apple)?|frankfurter(?: zap)?|frankfurter(?: yes)?|frankfurter(?: xerox)?|frankfurter(?: with)?|frankfurter(?: view)?|frankfurter(?: under)?|frankfurter(?: this)?|frankfurter(?: sort)?|frankfurter(?: rest)?|frankfurter(?: quick)?|frankfurter(?: pie)?|frankfurter(?: orange)?|frankfurter(?: nope)?|frankfurter(?: meal)?|frankfurter(?: letter)?|frankfurter(?: kayak)?|frankfurter(?: joseph)?|frankfurter(?: indiana)?|frankfurter(?: humus)?|frankfurter(?: gelatin)?|frankfurter(?: frankfurter)?|frankfurter(?: elephant)?|frankfurter(?: doormat)?|frankfurter(?: carrot)?|frankfurter(?: banana)?|frankfurter(?: apple)?|elephant(?: zap)?|elephant(?: yes)?|elephant(?: xerox)?|elephant(?: with)?|elephant(?: view)?|elephant(?: under)?|elephant(?: this)?|elephant(?: sort)?|elephant(?: rest)?|elephant(?: quick)?|elephant(?: pie)?|elephant(?: orange)?|elephant(?: nope)?|elephant(?: meal)?|elephant(?: letter)?|elephant(?: kayak)?|elephant(?: joseph)?|elephant(?: indiana)?|elephant(?: humus)?|elephant(?: gelatin)?|elephant(?: frankfurter)?|elephant(?: elephant)?|elephant(?: doormat)?|elephant(?: carrot)?|elephant(?: banana)?|elephant(?: apple)?|doormat(?: zap)?|doormat(?: yes)?|doormat(?: xerox)?|doormat(?: with)?|doormat(?: view)?|doormat(?: under)?|doormat(?: this)?|doormat(?: sort)?|doormat(?: rest)?|doormat(?: quick)?|doormat(?: pie)?|doormat(?: orange)?|doormat(?: nope)?|doormat(?: meal)?|doormat(?: letter)?|doormat(?: kayak)?|doormat(?: joseph)?|doormat(?: indiana)?|doormat(?: humus)?|doormat(?: gelatin)?|doormat(?: frankfurter)?|doormat(?: elephant)?|doormat(?: doormat)?|doormat(?: carrot)?|doormat(?: banana)?|doormat(?: apple)?|carrot(?: zap)?|carrot(?: yes)?|carrot(?: xerox)?|carrot(?: with)?|carrot(?: view)?|carrot(?: under)?|carrot(?: this)?|carrot(?: sort)?|carrot(?: rest)?|carrot(?: quick)?|carrot(?: pie)?|carrot(?: orange)?|carrot(?: nope)?|carrot(?: meal)?|carrot(?: letter)?|carrot(?: kayak)?|carrot(?: joseph)?|carrot(?: indiana)?|carrot(?: humus)?|carrot(?: gelatin)?|carrot(?: frankfurter)?|carrot(?: elephant)?|carrot(?: doormat)?|carrot(?: carrot)?|carrot(?: banana)?|carrot(?: apple)?|banana(?: zap)?|banana(?: yes)?|banana(?: xerox)?|banana(?: with)?|banana(?: view)?|banana(?: under)?|banana(?: this)?|banana(?: sort)?|banana(?: rest)?|banana(?: quick)?|banana(?: pie)?|banana(?: orange)?|banana(?: nope)?|banana(?: meal)?|banana(?: letter)?|banana(?: kayak)?|banana(?: joseph)?|banana(?: indiana)?|banana(?: humus)?|banana(?: gelatin)?|banana(?: frankfurter)?|banana(?: elephant)?|banana(?: doormat)?|banana(?: carrot)?|banana(?: banana)?|banana(?: apple)?|apple(?: zap)?|apple(?: yes)?|apple(?: xerox)?|apple(?: with)?|apple(?: view)?|apple(?: under)?|apple(?: this)?|apple(?: sort)?|apple(?: rest)?|apple(?: quick)?|apple(?: pie)?|apple(?: orange)?|apple(?: nope)?|apple(?: meal)?|apple(?: letter)?|apple(?: kayak)?|apple(?: joseph)?|apple(?: indiana)?|apple(?: humus)?|apple(?: gelatin)?|apple(?: frankfurter)?|apple(?: elephant)?|apple(?: doormat)?|apple(?: carrot)?|apple(?: banana)?|apple(?: apple)?) crashed', 'g') const str = `car apple view crashed car doormat elephant crashed car humus zap crashed car banana crashed car crashed ^ the above shouldn't match`; // Reset `lastIndex` if this regex is defined globally // regex.lastIndex = 0; let m; while ((m = regex.exec(str)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regex.lastIndex) { regex.lastIndex++; } // The result can be accessed through the `m`-variable. m.forEach((match, groupIndex) => { console.log(`Found match, group ${groupIndex}: ${match}`); }); }

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions