Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

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

/
/
is

Test String

Code Generator

Generated Code

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"""(PaintKit_sp_nukestripe_green_Tag)""\s+""(.*?)"""; string input = @" ""PaintKit_Default"" ""Unnamed Paint Kit"" ""PaintKit_Default_Tag"" ""-""// ""PaintKit_so_yellow"" ""It has individual parts spray-painted solid colors in a production line yellow color scheme."" ""PaintKit_so_yellow_Tag"" ""Bulldozer"" ""PaintKit_so_red"" ""It has individual parts spray-painted solid colors in a red and black color scheme."" ""PaintKit_so_red_Tag"" ""Red"" ""PaintKit_so_purple"" ""It has individual parts spray-painted solid colors in a black and purple color scheme."" ""PaintKit_so_purple_Tag"" ""Ultraviolet"" ""PaintKit_so_night"" ""It has individual parts spray-painted solid colors in a night ops color scheme."" ""PaintKit_so_night_Tag"" ""Night"" ""PaintKit_so_caramel"" ""It has individual parts spray-painted solid colors in a caramel and black color scheme."" ""PaintKit_so_caramel_Tag"" ""Caramel"" ""PaintKit_so_grassland"" ""It has individual parts spray-painted solid colors in a grassland color scheme."" ""PaintKit_so_grassland_Tag"" ""Grassland"" ""PaintKit_so_sand"" ""It has individual parts spray-painted solid colors in a sand dune color scheme."" ""PaintKit_so_sand_Tag"" ""Sand Dune"" ""PaintKit_so_tornado"" ""It has individual parts spray-painted solid colors in a tornado color scheme."" ""PaintKit_so_tornado_Tag"" ""Tornado"" ""PaintKit_so_whiteout"" ""It is spray-painted all white."" ""PaintKit_so_whiteout_Tag"" ""Whiteout"" ""PaintKit_so_jungle"" ""It has individual parts spray-painted solid colors in a jungle color scheme."" ""PaintKit_so_jungle_Tag"" ""Jungle"" ""PaintKit_so_tangerine"" ""It has individual parts spray-painted black and tangerine orange."" ""PaintKit_so_tangerine_Tag"" ""Demolition"" ""PaintKit_cu_catskulls_p90"" ""It has been hydro-dipped with a graphic of overlapping cat skulls."" ""PaintKit_cu_catskulls_p90_Tag"" ""Death by Kitty"" ""PaintKit_CSGO_Doomkitty_Tag"" ""Doomkitty"" ""PaintKit_hy_ddpat"" ""It has been painted using a Digital Disruptive Pattern (DDPAT) hydrographic."" ""PaintKit_hy_ddpat_Tag"" ""Forest DDPAT"" ""PaintKit_hy_ddpat_urb_Tag"" ""Urban DDPAT"" ""PaintKit_hy_ddpat_orange_Tag"" ""Orange DDPAT"" ""PaintKit_hy_arctic"" ""It has been painted using an arctic camo hydrographic."" ""PaintKit_hy_arctic_Tag"" ""Arctic Camo"" ""PaintKit_hy_forest"" ""It has been painted using a forest camouflage hydrographic."" ""PaintKit_hy_forest_Tag"" ""Wood Camo"" ""PaintKit_hy_forest_winter_Tag"" ""Winter Forest"" ""PaintKit_hy_forest_boreal_Tag"" ""Boreal Forest"" ""PaintKit_hy_desert"" ""It has been painted using a desert camouflage hydrographic."" ""PaintKit_hy_desert_Tag"" ""Desert Storm"" ""PaintKit_hy_copperhead"" ""It has been painted using a copperhead snakeskin-patterned hydrographic."" ""PaintKit_hy_copperhead_Tag"" ""Copperhead"" ""PaintKit_hy_skulls"" ""It has been painted using a skull-patterned hydrographic with red or black accents."" ""PaintKit_hy_skulls_Tag"" ""Skulls"" ""PaintKit_hy_webs"" ""It has been painted using a spider web-patterned hydrographic over a red base coat and finished with a semi-gloss topcoat."" ""PaintKit_hy_webs_Tag"" ""Crimson Web"" ""PaintKit_hy_ak47lam"" ""It has been given a laminate stock."" ""PaintKit_hy_ak47lam_Tag"" ""Red Laminate"" ""PaintKit_hy_ak47lam_bw_Tag"" ""Black Laminate"" ""PaintKit_hy_gelpen"" ""It has been painted using a hydrographic of a gel pen doodle."" ""PaintKit_hy_gelpen_Tag"" ""Gunsmoke"" ""PaintKit_hy_v_tiger"" ""It has been painted using a jungle tiger hydrographic."" ""PaintKit_hy_v_tiger_Tag"" ""Jungle Tiger"" ""PaintKit_hy_granite"" ""It has been painted in a marbleized pattern."" ""PaintKit_hy_blizzard_Tag"" ""Blizzard Marbleized"" ""PaintKit_sp_spray"" ""It has been spray-painted freehand with short, thick lines in contrasting colors."" ""PaintKit_sp_spray_Tag"" ""Contrast Spray"" ""PaintKit_sp_spray_jungle_Tag"" ""Jungle Spray"" ""PaintKit_sp_tape_dots"" ""It has been spray-painted using ripped tape strips and perforated metal as stencils."" ""PaintKit_sp_tape_dots_urban_Tag"" ""Urban Perforated"" ""PaintKit_sp_leaves"" ""It has been spray-painted using leaves as stencils."" ""PaintKit_sp_leaves_Tag"" ""Forest Leaves"" ""PaintKit_sp_short_tape"" ""It has been spray-painted using short pieces of tape as stencils."" ""PaintKit_sp_short_tape_Tag"" ""Lichen Dashed"" ""PaintKit_sp_short_tape_urban_Tag"" ""Urban Dashed"" ""PaintKit_sp_tape"" ""It has been spray-painted using a tangle of spray-paint as a stencil."" ""PaintKit_sp_tape_urban_Tag"" ""Urban Masked"" ""PaintKit_sp_mesh"" ""It has been spray-painted using mesh fencing and cardboard cutouts as stencils."" ""PaintKit_sp_mesh_tan_Tag"" ""Safari Mesh"" ""PaintKit_sp_mesh_glacier_Tag"" ""Glacier Mesh"" ""PaintKit_sp_snake"" ""It has been spray-painted using a snakeskin stencil in patches that have been outlined freehand."" ""PaintKit_sp_snake_Tag"" ""Snake Camo"" ""PaintKit_an_silver"" ""It has been painted with a chrome base coat and candied in transparent silver anodized effect paint."" ""PaintKit_an_silver_Tag"" ""Silver"" ""PaintKit_an_red"" ""It has been painted with a chrome base coat and candied in transparent red anodized effect paint."" ""PaintKit_an_red_Tag"" ""Hot Rod"" ""PaintKit_an_navy"" ""It has been painted with a chrome base coat and candied in transparent navy blue anodized effect paint."" ""PaintKit_an_navy_Tag"" ""Anodized Navy"" ""PaintKit_am_urban"" ""It has been painted using an urban Digital Disruptive Pattern (DDPAT) hydrographic over a metallic base coat."" ""PaintKit_am_urban_Tag"" ""Metallic DDPAT"" ""PaintKit_am_tiger"" ""It has been gold-plated and hand-etched in a tiger stripe pattern."" ""PaintKit_am_tiger_Tag"" ""Gold Tiger"" ""PaintKit_am_dragon_glock"" ""It has been painted using a dragon decal over a metallic base coat."" ""PaintKit_am_dragon_glock_Tag"" ""Dragon Tattoo"" ""PaintKit_am_caustics"" ""It has been painted using a red and white hydrographic over a charcoal metallic base coat."" ""PaintKit_am_caustics_Tag"" ""Caustics"" ""PaintKit_am_lightning_awp"" ""It has been painted with a lightning strike motif using anodizing effect paints over a metallic base coat."" ""PaintKit_am_lightning_awp_Tag"" ""Lightning Strike"" ""PaintKit_am_ossify"" ""It has been painted using a transparent lime green abstract hydrographic over a metallic base coat."" ""PaintKit_am_ossify_Tag"" ""Ossified"" ""PaintKit_aa_flames"" ""It has been painted by airbrushing transparent paints over a chrome base coat."" ""PaintKit_aa_flames_Tag"" ""Blaze"" ""PaintKit_aa_splash_p250"" ""It has been painted by airbrushing transparent paints through a stencil over a chrome base coat."" ""PaintKit_aa_splash_p250_Tag"" ""Splash"" ""PaintKit_aa_fade"" ""It has been painted by airbrushing transparent paints that fade together over a chrome base coat."" ""PaintKit_aa_fade_Tag"" ""Fade"" ""PaintKit_aq_copper"" ""It has been copper plated."" ""PaintKit_aq_copper_Tag"" ""Copper"" ""PaintKit_aq_blued"" ""It has been cold blued."" ""PaintKit_aq_blued_Tag"" ""Blue Steel"" ""PaintKit_aq_forced"" ""It has been given a forced patina using lemon and mustard dripped onto the surface."" ""PaintKit_aq_forced_Tag"" ""Stained"" ""PaintKit_aq_oiled"" ""It has been color case-hardened through the application of wood charcoal at high temperatures."" ""PaintKit_aq_oiled_Tag"" ""Case Hardened"" ""PaintKit_am_zebra"" ""It has been painted in a zebra-stripe pattern with aluminum and chrome paints with various reflectivities, and has then been covered with a tomato red candy coat."" ""PaintKit_am_zebra_Tag"" ""Slaughter"" ""PaintKit_am_zebra_dark"" ""It has been painted in an aquatic-stripe pattern with charcoal metallic paints of various reflectivities over a chrome base coat."" ""PaintKit_am_zebra_dark_Tag"" ""Dark Water"" ""PaintKit_aa_vertigo"" ""It has been painted with a pearl base coat, then spray-painted black through a stencil in a graphic pattern."" ""PaintKit_aa_vertigo_Tag"" ""Hypnotic"" ""PaintKit_aq_rust"" ""Although the exterior surfaces have rusted, this firearm is still perfectly operational."" ""PaintKit_aq_rust_Tag"" ""Rusty"" ""PaintKit_am_carbon_fiber"" ""It has been painted using a carbon fiber hydrographic over a graphite base coat."" ""PaintKit_am_carbon_fiber_Tag"" ""Carbon Fiber"" ""PaintKit_am_scorpion_p2000"" ""It has been painted using anodized-effect paints in a rippled fade pattern with a red scorpion decal on the grip."" ""PaintKit_am_scorpion_p2000_Tag"" ""Scorpion"" ""PaintKit_hy_feathers_aug"" ""It has been decorated with dry-transfer decals of eagle feathers."" ""PaintKit_hy_feathers_aug_Tag"" ""Wings"" ""Paintkit_sp_palm"" ""It has been spray-painted using cardboard cutouts, fine mesh, and palm leaves as stencils."" ""Paintkit_sp_palm_Tag"" ""Palm"" ""PaintKit_cu_walnut_nova"" ""It has a figured walnut stock."" ""PaintKit_cu_walnut_nova_Tag"" ""Walnut"" ""PaintKit_aq_brass"" ""It has brass parts."" ""PaintKit_aq_brass_Tag"" ""Brass"" ""PaintKit_hy_blam"" ""It has been painted using a hydrographic printed with comic book onomatopoeia over an orange base coat."" ""PaintKit_hy_blam_Tag"" ""KABOOM!"" ""PaintKit_hy_blam_simple_Tag"" ""BOOM"" ""PaintKit_sp_dapple"" ""It has been spray-painted in a sun-dappled pattern."" ""PaintKit_sp_dapple_Tag"" ""Scorched"" ""PaintKit_sp_splash_p250"" ""It has been spray-painted and decorated using a splash-shaped stencil."" ""PaintKit_sp_splash_p250_Tag"" ""Splash"" ""PaintKit_hy_hunter_modern"" ""It has been painted using a photographic hunting camo hydrographic."" ""PaintKit_hy_hunter_modern_Tag"" ""Modern Hunter"" ""PaintKit_hy_hunter_blaze_pink_Tag"" ""Splash Jam"" ""PaintKit_hy_hunter_blaze_orange_Tag"" ""Blaze Orange"" ""PaintKit_sp_nukestripe"" ""It has been spray-painted with radiological warning hazard patterns."" ""PaintKit_sp_nukestripe_brown_Tag"" ""Irradiated Alert"" ""PaintKit_sp_nukestripe_maroon_Tag"" ""Fallout Warning"" ""PaintKit_sp_nukestripe_orange_Tag"" ""Radiation Hazard"" ""PaintKit_sp_nukestripe_green_Tag"" ""Nuclear Threat"" ""PaintKit_sp_zebracam"" ""It has been spray-painted in a zebra stripe pattern."" ""PaintKit_sp_zebracam_Tag"" ""Predator"" ""PaintKit_sp_zebracam_bw_Tag"" ""Faded Zebra"" ""PaintKit_CSGO_Camo"" ""It has been painted using a hydrographic in the Global Offensive camo pattern."" ""PaintKit_CSGO_Camo_Tag"" ""GO Camo"" ""PaintKit_CSGO_Icosahedron"" ""It has been painted using a geometric-patterned hydrographic."" ""PaintKit_CSGO_Icosahedron_Tag"" ""Memento"""; RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Singleline; Match m = Regex.Match(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