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

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"(?sU)(?=\{[^}]*:1017).*:""(.*)"""; string input = @"{""wvw_matches"":[{""wvw_match_id"":""2-1"",""red_world_id"":2202,""blue_world_id"":2101,""green_world_id"":2201,""start_time"":""2015-10-16T18:00:00Z"",""end_time"":""2015-10-23T18:00:00Z""},{""wvw_match_id"":""2-6"",""red_world_id"":2206,""blue_world_id"":2207,""green_world_id"":2205,""start_time"":""2015-10-16T18:00:00Z"",""end_time"":""2015-10-23T18:00:00Z""},{""wvw_match_id"":""2-2"",""red_world_id"":2104,""blue_world_id"":2010,""green_world_id"":2003,""start_time"":""2015-10-16T18:00:00Z"",""end_time"":""2015-10-23T18:00:00Z""},{""wvw_match_id"":""2-3"",""red_world_id"":2301,""blue_world_id"":2002,""green_world_id"":2012,""start_time"":""2015-10-16T18:00:00Z"",""end_time"":""2015-10-23T18:00:00Z""},{""wvw_match_id"":""2-7"",""red_world_id"":2105,""blue_world_id"":2011,""green_world_id"":2005,""start_time"":""2015-10-16T18:00:00Z"",""end_time"":""2015-10-23T18:00:00Z""},{""wvw_match_id"":""2-4"",""red_world_id"":2203,""blue_world_id"":2103,""green_world_id"":2007,""start_time"":""2015-10-16T18:00:00Z"",""end_time"":""2015-10-23T18:00:00Z""},{""wvw_match_id"":""2-5"",""red_world_id"":2014,""blue_world_id"":2204,""green_world_id"":2013,""start_time"":""2015-10-16T18:00:00Z"",""end_time"":""2015-10-23T18:00:00Z""},{""wvw_match_id"":""2-9"",""red_world_id"":2004,""blue_world_id"":2006,""green_world_id"":2102,""start_time"":""2015-10-16T18:00:00Z"",""end_time"":""2015-10-23T18:00:00Z""},{""wvw_match_id"":""2-8"",""red_world_id"":2008,""blue_world_id"":2001,""green_world_id"":2009,""start_time"":""2015-10-16T18:00:00Z"",""end_time"":""2015-10-23T18:00:00Z""},{""wvw_match_id"":""1-1"",""red_world_id"":1003,""blue_world_id"":1008,""green_world_id"":1019,""start_time"":""2015-10-17T01:00:00Z"",""end_time"":""2015-10-24T01:00:00Z""},{""wvw_match_id"":""1-2"",""red_world_id"":1009,""blue_world_id"":1016,""green_world_id"":1017,""start_time"":""2015-10-17T01:00:00Z"",""end_time"":""2015-10-24T01:00:00Z""},{""wvw_match_id"":""1-3"",""red_world_id"":1014,""blue_world_id"":1011,""green_world_id"":1005,""start_time"":""2015-10-17T01:00:00Z"",""end_time"":""2015-10-24T01:00:00Z""},{""wvw_match_id"":""1-4"",""red_world_id"":1012,""blue_world_id"":1010,""green_world_id"":1021,""start_time"":""2015-10-17T01:00:00Z"",""end_time"":""2015-10-24T01:00:00Z""},{""wvw_match_id"":""1-5"",""red_world_id"":1002,""blue_world_id"":1004,""green_world_id"":1018,""start_time"":""2015-10-17T01:00:00Z"",""end_time"":""2015-10-24T01:00:00Z""},{""wvw_match_id"":""1-6"",""red_world_id"":1001,""blue_world_id"":1013,""green_world_id"":1006,""start_time"":""2015-10-17T01:00:00Z"",""end_time"":""2015-10-24T01:00:00Z""},{""wvw_match_id"":""1-7"",""red_world_id"":1022,""blue_world_id"":1015,""green_world_id"":1007,""start_time"":""2015-10-17T01:00:00Z"",""end_time"":""2015-10-24T01:00:00Z""},{""wvw_match_id"":""1-8"",""red_world_id"":1024,""blue_world_id"":1023,""green_world_id"":1020,""start_time"":""2015-10-17T01:00:00Z"",""end_time"":""2015-10-24T01:00:00Z""}]}"; Match m = Regex.Match(input, pattern); Console.WriteLine("'{0}' found at index {1}", m.Value, m.Index); } }

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