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

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

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 AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm