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]
  • 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 = /(?(?=The following software are installed on the remote host :\s+))(?<software>[^\[]+)\[version\s(?<version>[^\]]+)\]/g; // Alternative syntax using RegExp constructor // const regex = new RegExp('(?(?=The following software are installed on the remote host :\\s+))(?<software>[^\\[]+)\\[version\\s(?<version>[^\\]]+)\\]', 'g') const str = `"20811","","","None","182.56.44.12","tcp","445","Microsoft Windows Installed Software Enumeration (credentialed check)","It is possible to enumerate installed software.","This plugin lists software potentially installed on the remote host by crawling the registry entries in : HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall HKLM\\SOFTWARE\\Microsoft\\Updates Note that these entries do not necessarily mean the applications are actually installed on the remote host - they may have been left behind by uninstallers, or the associated files may have been manually removed.","Remove any applications that are not compliant with your organization's acceptable use and security policies.",""," The following software are installed on the remote host : 7-Zip 15.12 (x64) [version 15.12] Rapid Recovery Agent [version 6.1.3.100] JXplorer [version 3.3.1] System Center Endpoint Protection [version 4.10.207.0] [installed on 2016/10/26] Notepad++ [version 6.8.8] WinPcap 4.1.3 [version 4.1.0.2980] Wireshark 2.2.4 (64-bit) [version 2.2.4] Windows Firewall Configuration Provider [version 1.2.3412.0] [installed on 2015/11/20] Microsoft Visual C++ 2013 x86 Minimum Runtime - 12.0.21005 [version 12.0.21005] [installed on 2015/11/20] Microsoft Visual C++ 2010 x64 Redistributable - 10.0.40219 [version 10.0.40219] [installed on 2015/12/17] Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.40649 [version 12.0.40649] [installed on 2017/01/26] Java 7 Update 79 (64-bit) [version 7.0.790] [installed on 2015/12/14] Configuration Manager Client [version 5.00.8239.1000] [installed on 2018/03/28] Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.40649 [version 12.0.40649.5] Microsoft Endpoint Protection Management Components [version 4.10.0207.0] [installed on 2016/10/26] Java SE Development Kit 7 Update 79 (64-bit) [version 1.7.0.790] [installed on 2015/12/14] Microsoft Visual C++ 2005 Redistributable [version 8.0.61001] [installed on 2015/12/17] Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.21005 [version 12.0.21005.1] AppRecovery Agent [version 6.1.3.100] [installed on 2018/03/18] Microsoft Silverlight [version 5.1.30514.0] [installed on 2015/11/20] Microsoft Policy Platform [version 1.2.3602.0] [installed on 2015/11/20] Microsoft Forefront Endpoint Protection 2010 Server Management [version 4.10.0207.0] [installed on 2016/10/26] Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.40649 [version 12.0.40649] [installed on 2017/01/26] Microsoft Security Client [version 4.10.0207.0] [installed on 2016/10/26] Microsoft SQL Server System CLR Types (x64) [version 10.51.2500.0] [installed on 2015/12/17] Microsoft SQL Server 2008 R2 Management Objects (x64) [version 10.51.2500.0] [installed on 2015/12/17] Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219 [version 10.0.40219] [installed on 2015/12/17] Microsoft Visual C++ 2013 x86 Additional Runtime - 12.0.21005 [version 12.0.21005] [installed on 2015/11/20] Microsoft Visual C++ 2005 Redistributable (x64) [version 8.0.61000] [installed on 2015/11/20] Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.21005 [version 12.0.21005.1] "`; // 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