Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • 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

Substitution
Processing...

Code Generator

Generated Code

const regex = /^((?!\sid: '(.*?)',).)+$/gm; // Alternative syntax using RegExp constructor // const regex = new RegExp('^((?!\\sid: \'(.*?)\',).)+$', 'gm') const str = `result get: [ { __tenant: 'dev_gaus', partitionKey: 'customization_custContextsByStudent0', ref: 'CustContext-6faccf25-7cff-4d28-aa01-ef242d43f9eb', id: '6950d15e-332d-4dcf-8f60-c887b52b7c74', timestampOfLastReducedEvent: '2016-10-17T10:43:22.562Z', payload: { custContextId: '6faccf25-7cff-4d28-aa01-ef242d43f9eb', students: [Object] }, _rid: '0jBGAOGkewADAAAAAACABA==', _self: 'dbs/0jBGAA==/colls/0jBGAOGkewA=/docs/0jBGAOGkewADAAAAAACABA==/', _etag: '"2900f221-0000-0000-0000-5804ab5d0000"', _attachments: 'attachments/', _ts: 1476701006 }, { __tenant: 'dev_gaus', partitionKey: 'customization_custContextsByStudent0', ref: 'CustContext-c19a7792-2521-4491-833a-6462cf5fea84', id: 'f37f54bf-ab58-4e4a-b5d3-5aeff0abdd65', timestampOfLastReducedEvent: '2016-10-17T10:46:16.289Z', payload: { '55': [Object] }, _rid: '0jBGAOGkewAEAAAAAACABA==', _self: 'dbs/0jBGAA==/colls/0jBGAOGkewA=/docs/0jBGAOGkewAEAAAAAACABA==/', _etag: '"2900f321-0000-0000-0000-5804abfa0000"', _attachments: 'attachments/', _ts: 1476701163 }, { __tenant: 'dev_gaus', partitionKey: 'customization_custContextsByStudent0', ref: 'CustContext-d528c0aa-71c6-4b20-b828-6e8068d77900', id: '4358d14c-c001-4d46-bc8b-9d29a6a426b7', timestampOfLastReducedEvent: '2016-10-17T10:49:48.122Z', payload: { '52': [Object], '55': [Object] }, _rid: '0jBGAOGkewAIAAAAAACABA==', _self: 'dbs/0jBGAA==/colls/0jBGAOGkewA=/docs/0jBGAOGkewAIAAAAAACABA==/', _etag: '"2900f721-0000-0000-0000-5804acce0000"', _attachments: 'attachments/', _ts: 1476701375 } ] `; const subst = ``; // The substituted value will be contained in the result variable const result = str.replace(regex, subst); console.log('Substitution result: ', result);

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