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

Substitution
Processing...

Code Generator

Generated Code

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"(.*?\""\s+)\bOR\b(\s+application.*?)"; string substitution = @"$1||$2"; string input = @"(quote.AGE was 24 AND (application.path = ""**\acad.exe"" OR application.path = ""**\dxfdwg.exe"" OR application.path = ""**\EXCELSIOR.EXE"" OR application.path = ""**\iges.exe"" OR application.path = ""**\notepad.exe"" OR application.path = ""**\run_journal.exe"" OR application.path = ""**\AcroRd32.exe"" OR application.path = ""**\dllhost.exe"" OR application.path = ""**\powerpnt.exe"" OR application.path = ""**\Edge.exe"" OR application.path = ""**\step203ug.exe"" OR application.path = ""**\step214ug.exe"" OR application.path = ""**\VisView.exe"" OR application.path = ""**\Teamcenter.exe"" OR application.path = ""**\ug_convert_part.exe"" OR application.path = ""**\ugraf.exe"" OR application.path = ""**\ugtopv.exe"" OR application.path = ""**\wmplayer.exe"" OR application.path = ""**\winword.exe"" OR application.path = ""**\wordpad.exe"" OR application.path = ""**\vlc.exe"" OR application.path = ""**\dwgviewr.exe"" OR application.name = ""RMS"" OR application.path = ""**\acrobat.exe"" OR application.path = ""**\Alias.exe"" OR application.path = ""**\awtessd.exe"" OR application.path = ""**\proe.exe"" OR application.path = ""**\STPViewer.exe"" OR application.path = ""**\gom_inspect.exe"" OR application.path = ""**\gom_cad_server2.exe"" OR application.path = ""**\sldworks.exe"" OR application.path = ""**\sldworks_fs.exe"" OR application.path = ""**\sldProcMon.exe"" OR application.path = ""**\AdapplicationMgr.exe"" OR application.path = ""**\AdapplicationMgrSvc.exe"" OR application.path = ""**\SE3Dtrans.exe"" OR application.path = ""**\stamp.exe"" OR application.path = ""**\psolid.exe"" OR application.path = ""**\mpid.exe"" OR application.path = ""**\mpirun.exe"" OR application.path = ""**\FS.exe"" OR application.path = ""**\xtop.exe"" OR application.path = ""**\pro_comm_msg.exe"" OR application.path = ""**\nmsd.exe"" OR application.path = ""**\creoagent.exe"" OR application.path = ""**\parametric.exe"" OR application.path = ""**\PDFEditor.exe"" OR application.path = ""**\CNEXT.exe"" OR application.path = ""**\drafter.exe"" OR application.path = ""**\convert.exe"" OR application.path = ""**\ActCut3D.exe"" OR application.path = ""**\ppcbasic.exe"" OR application.path = ""**\deltamesh_stamping.exe"" OR application.path = ""Xasfsf"" OR application.path = ""sfdsdf""))"; RegexOptions options = RegexOptions.Multiline; Regex regex = new Regex(pattern, options); string result = regex.Replace(input, substitution); } }

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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx