Regular Expressions 101

Save & Share

  • Regex Version: ver. 249
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

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 single character of: a, b, c or d
    [[ab][cd]]
  • 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]
  • Character class intersection
    [\w&&[^\d]]
  • 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
No Match

"
"

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 = ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)" Local $sString = "Column,Row,Value,Column Title,Question,Answer" & @CRLF & _ "A,1,100,Comics,"This series following a team of mutants, was actually cancelled during it's first run and did not reach its popular status until a revival severla years later.",X-Men" & @CRLF & _ "A,2,200,Comics,This demonic hero has a big gun and an even bigger right fist.,Hellboy" & @CRLF & _ "A,3,300,Comics,This mostly self-published series follows three osteo-minded cousins through a series of misadventures.,Who is..." & @CRLF & _ "A,4,400,Comics,"Superman may be considered the first, but this magical superhero also debuted in Action Comics #1, 7 pages after Superman.",Zatara" & @CRLF & _ "A,5,500,Comics,"Sharing the alias of a few villainous iterations in the main comics, this character from the ""What If?"" line of comics is a spider bitten by a radioactive human.",Webster Weaver / Man-Spider" & @CRLF & _ "B,1,100,Disney,"One of these per day will keep the doctor away, but a poisoned one requires a visit from nobility.",An Apple" & @CRLF & _ "B,2,200,Disney,"This character, one of seven of his kind, is the only one who's name is not an adjective.",Doc" & @CRLF & _ "B,3,300,Disney,This kitchen essential is the weapon of choice for Rapunzel.,A cast iron frying pan" & @CRLF & _ "B,4,400,Disney,Billy Joel lends his voice to this canine character.,Dodger" & @CRLF & _ "B,5,500,Disney,This is the last animated feature to be produced by Walt Disney until his death in 1966.,The Jungle Book" & @CRLF & _ "C,1,100,MTG,"A player of the game is called this, eventually added as a card type.",A Planeswalker" & @CRLF & _ "C,2,200,MTG,Much of early Magic is set on this plane.,Dominaria" & @CRLF & _ "C,3,300,MTG,This space between planes is also the original home of the Eldrazi.,The Blind Eternities" & @CRLF & _ "C,4,400,MTG,"Often mistakenly used when referring to double face cards, this mechanic originated in Kamigawa block",Flip Cards" & @CRLF & _ "C,5,500,MTG,This base set is the first set designated with a numbered release.,Fourth Edition" & @CRLF & _ "D,1,100,Pokemon,"""Ay cutie, are you an electric rodent or can I get a...""",Pikachu" & @CRLF & _ "D,2,200,Pokemon,"In the card game, there are this many basic energy types",Nine" & @CRLF & _ "D,3,300,Pokemon,This fighting type pokemon's english name is partially inspired from a famous action comedy movie star.,Hitmonchan" & @CRLF & _ "D,4,400,Pokemon,"In the original anime, albeit being a generation 2 pokemon officially, this is the first legendary Pokemon Ash Ketchum sees.",Ho-oh" & @CRLF & _ "D,5,500,Pokemon,"As of generation 9, this is the most common type of Pokemon",Water" & @CRLF & _ "E,1,100,Board Games,This generic wooden piece is usually used to represent a person.,A meeple" & @CRLF & _ "E,2,200,Board Games,This board game changed a rule to allow proper nouns and it has been downhill ever since.,Scrabble" & @CRLF & _ "E,3,300,Board Games,This board game takes its name and theme from a famous road in Japan.,Tokaido" & @CRLF & _ "E,4,400,Board Games,The commonly used standard playing card deck has origins in this Europeon country. ,France" & @CRLF & _ "E,5,500,Board Games,"This is what a super nerd calls a 20-sided die, also known as it's geometric name.",icosahedron" & @CRLF & _ "F,1,100,"Words that rhyme with ""piss""",A cat or a snake will perform this when upset.,Hiss" & @CRLF & _ "F,2,200,"Words that rhyme with ""piss""",You may give one of these to someone you love.,Kiss" & @CRLF & _ "F,3,300,"Words that rhyme with ""piss""","When class is over, the teacher will perform this action.",Dismiss" & @CRLF & _ "F,4,400,"Words that rhyme with ""piss""","If you stare into this for too long, it will stare back at you.",Abyss" & @CRLF & _ "F,5,500,"Words that rhyme with ""piss""",When you remember fondly.,Reminisce" 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