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
There are currently no sponsors. Become a sponsor today!
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 = @"val"":\x20?"".*?(?<Dex1>.*)|description"":\x20?""(?<Dex2>.*)|""text"":\x20?""(?<Dex3>.*)"; string input = @"[{ ""latestID"": 166, ""parent"": ""story_chapter_5_40_rival"", ""type"": ""dialogue"", ""id"": ""story_chapter_5_41_rival"", ""location"": ""black"", ""music"": ""default"", ""random"": false, ""conditions"": [], ""val"": ""The girls are disappointed that we don't have more fans. Additionally, you haven't got enough [color:red]Advancement Points</color> yet."", ""description"": ""[actor_0] has been suspended from school for lewd behavior. Apparently, she decided not to wear panties and then flashed her history teacher. When asked about it, she said the look on the face of \""that stuffy old crone\"" was priceless, and getting suspended was worth it. \n\nDespite the rather entertaining nature of the story, [actor_0] shouldn't get into a habit of behaving recklessly and thinking there won't ever be consequences. It might make sense to further discipline her, especially since she doens't seem to be taking her suspension very seriously.\n\nOn the other hand, if you leaked this story online, getting kicked out of school is often seen as \""cool\"" and might increase her popularity with rebel type fans. \n\nWhat will you do?"", ""actors"": [], ""setup"": [{ ""val"": ""Hello, [player:SirMaam]! Welcome to the [color:red]Ero Events</color> status tracker."", ""tag"": ""story_rival"", ""posX"": 0, ""facing"": ""default"", ""startHidden"": true } ], ""scene_params"": [], ""script"": [null, null, { ""id"": 0, ""type"": ""message"", ""actor"": ""story_rival"", ""val"": ""Ah. [player:polite]. So glad you could join me."", ""effect"": [{ ""target"": ""meta"", ""parameter"": ""set_cg"", ""formula"": ""ramen_m_m ramen_m_f ramen_f_m ramen_f_f"" }, { ""target"": ""audio"", ""parameter"": ""music"", ""formula"": ""retro_cafe_theme"" } ], ""requirements"": [], ""script"": [], ""vo"": ""RivalM_048_Greeting6"" }, { ""id"": 1, ""type"": ""choice"", ""actor"": null, ""val"": ""What big secret are you hiding?"", ""effect"": [], ""requirements"": [], ""script"": [{ ""id"": 2, ""type"": ""message"", ""actor"": ""story_rival"", ""val"": ""Straight to business, eh? Let's get right to it, then."", ""effect"": [], ""requirements"": [], ""script"": [], ""vo"": ""RivalM_013_Fun1"" } ] }, { ""id"": 3, ""script"": [] }, { ""id"": 10, ""type"": ""choice"", ""actor"": null, ""val"": ""Phantasm Facade"", ""effect"": [], ""requirements"": [], ""script"": [] }, { ""id"": 11, ""type"": ""choice"", ""actor"": null, ""val"": ""Both [rival_group] and Phantasm Facade"", ""effect"": [], ""requirements"": [], ""script"": [] }, { ""id"": 12, ""type"": ""choice"", ""actor"": null, ""val"": ""I don't know"", ""effect"": [], ""requirements"": [], ""script"": [] }, { ""id"": 13, ""type"": ""message"", ""actor"": ""story_rival"", ""val"": ""Yes. It was difficult for me to move all of the pieces into place, but Phantasm Facade was selected as part of the final group selection."", ""effect"": [], ""requirements"": [], ""script"": [], ""vo"": ""RivalM_014_Fun2"" }, { ""id"": 14, ""type"": ""message"", ""actor"": ""story_rival"", ""val"": ""The most difficult part was finding a way to get Phantasm Facade through the process without ever exposing myself as the mastermind behind it."", ""effect"": [], ""requirements"": [], ""script"": [] }, { ""id"": 15, ""type"": ""message"", ""actor"": ""story_rival"", ""val"": ""The group itself is tied to a shell corporation that I created through a law firm that serves intermediary to protect my anonymity, but the final interview round was a bit of an unexpected curveball."", ""effect"": [], ""requirements"": [], ""script"": [] }, { ""id"": 16, ""type"": ""message"", ""actor"": ""story_rival"", ""val"": ""I had debated whether to hire an actor to represent the group before the answer smacked me in the face:"", ""effect"": [], ""requirements"": [], ""script"": [], ""vo"": ""RivalM_037_Worried3"" }, { ""id"": 17, ""type"": ""message"", ""actor"": ""story_rival"", ""val"": ""I had one of the idols from the group go to the interview and pose as the manager."", ""effect"": [], ""requirements"": [], ""script"": [], ""vo"": ""RivalM_014_Fun2"" }, { ""id"": 18, ""type"": ""message"", ""actor"": ""story_rival"", ""val"": ""They're all talented performers, and getting through that interview was just one last performance."", ""description"": ""You spend some time talking through the issue with [actor_0:full]. You point out that the discomfort she's going through now is definitely unpleasant, but it will pay off in the future. \n\nSeeing this as a opportunity to overcome an obstacle rather than being a victim helps empower her, and [actor_0] feels more able to deal with the situation. She thanks you for taking the time to talk with her. \n\nOver the next week, her newfound tenacity earns her respect among the other students and the bullying attempts graually subside."", ""text"": ""did you see [actor_0] in this month's issue?"" ""text"": ""I gotta say, [actor_0] being \""all natural\"" is an understatement"" ""val"": ""I'm sure that's it. So don't stress about this. What you should be doing is imagining what kind of suit <blue>Kiyomi</color> received. I bet it's something totally lewd!"" ""val"": ""Merry Christmas, [girl1]. (END)"", ""description"": ""You spend some time talking through the issue with [actor_0:full]. You point out that the discomfort she's going through now is definitely unpleasant, but it will pay off in the future. \n\nSeeing this as a opportunity to overcome an obstacle rather than being a victim helps empower her, and [actor_0] feels more able to deal with the situation. She thanks you for taking the time to talk with her. \n\nOver the next week, her newfound tenacity earns her respect among the other students and the bullying attempts graually subside."", ""description"": ""Some obsessive fans have discovered that [actor_0:full]'s mother has an OnlyFans account with nude photos. The news has spread through the fanbase rapidly, and there are a lot of conflicting voices and opinions. \n\nSome fans are supportive of both [actor_0] and her mother. Others are critical of her mother but still supportive of [actor_0]. And still others condemn them both. \n\n[actor_0] is understandably distraught and unsure how to handle the growing drama. She's asking for your advice on how to respond."", }, { ""poster"": ""F_HC_YA"", ""text"": ""Incredible! I wish I looked as good as her when I'm exercising!"" ""effect"": [], ""requirements"": [], ""script"": [] }, { ""id"": 19, ""val"": ""(Spend 1 Influence) *Convince her to take more clothing risks*"", ""val"": ""I have to go... (END)"", ""type"": ""message"", ""val"": ""You dutifully turn around while [girl2:casual] undresses and puts on the swimsuit."", ""val"": "", ""actor"": ""story_rival"", ""val"": ""In short, I have two groups in the running, competing against each other, and the committee members are none the wiser."", ""val"": ""Ah! [player:SirMaam], I didn't expect you to be so forward."", ""val"": ""(Spend 1 Influence) *Convince her to take more clothing risks*"", ""effect"": [{ ""target"": ""story_rival"", ""parameter"": ""popup_left"", ""formula"": ""default smug sparkle none"" ""val"": ""Hello, [player:SirMaam]! Welcome to the [color:red]Ero Events</color> status tracker."", } ], ""requirements"": [], ""script"": [], ""vo"": ""RivalM_034_Shocked3"" }, { ""id"": 20, ""type"": ""message"", ""actor"": ""story_rival"", ""val"": ""Phantasm Facade is, of course, too avant garde to be selected as the primary."", ""effect"": [],"; RegexOptions options = RegexOptions.Multiline; foreach (Match m in Regex.Matches(input, pattern, options)) { 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