Regular Expressions 101

Save & Share

  • Regex Version: ver. 5
  • 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 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

/
/
gmi

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 = "(?mi)(?>.*?(\pL)(?!.*\1)){26}" Local $sString = "# Pangrams" & @CRLF & _ "" & @CRLF & _ "Cwm fjord bank glyphs vext quiz." & @CRLF & _ "Fox nymphs grab quick jived waltz." & @CRLF & _ "Glib jocks quiz nymph to vex dwarf." & @CRLF & _ "Quick zephyrs blow, vexing daft Jim." & @CRLF & _ "How vexingly quick daft zebras jump!" & @CRLF & _ "Mr. Jock, TV quiz PhD, bags few lynx." & @CRLF & _ "Sphinx of black quartz, judge my vow." & @CRLF & _ "The five boxing wizards jump quickly." & @CRLF & _ "Waltz, nymph, for quick jigs vex Bud." & @CRLF & _ "Quick fox jumps nightly above wizard." & @CRLF & _ "Jackdaws love my big sphinx of quartz." & @CRLF & _ "Two driven jocks help fax my big quiz." & @CRLF & _ "Fickle jinx bog dwarves spy math quiz." & @CRLF & _ "Public junk dwarves hug my quartz fox." & @CRLF & _ "Five quacking zephyrs jolt my wax bed." & @CRLF & _ "Pack my box with five dozen liquor jugs." & @CRLF & _ "Sympathizing would fix Quaker objectives." & @CRLF & _ "When zombies arrive, quickly fax judge Pat." & @CRLF & _ "Waxy and quivering, jocks fumble the pizza." & @CRLF & _ "The quick brown fox jumps over the lazy dog." & @CRLF & _ "Woven silk pyjamas exchanged for blue quartz." & @CRLF & _ "The jay, pig, fox, zebra and my wolves quack!" & @CRLF & _ "A wizard's job is to vex chumps quickly in fog." & @CRLF & _ "The quick onyx goblin jumps over the lazy dwarf." & @CRLF & _ "Foxy diva Jennifer Lopez wasn't baking my quiche." & @CRLF & _ "Watch "Jeopardy!", Alex Trebek's fun TV quiz game." & @CRLF & _ "By Jove, my quick study of lexicography won a prize!" & @CRLF & _ "My girl wove six dozen plaid jackets before she quit." & @CRLF & _ "Grumpy wizards make a toxic brew for the jovial queen." & @CRLF & _ "A quivering Texas zombie fought republic linked jewelry." & @CRLF & _ "The wizard quickly jinxed the gnomes before they vaporized." & @CRLF & _ "All questions asked by five watched experts amaze the judge." & @CRLF & _ "Back in June we delivered oxygen equipment of the same size." & @CRLF & _ "We promptly judged antique ivory buckles for the next prize." & @CRLF & _ "Jim quickly realized that the beautiful gowns are expensive." & @CRLF & _ "" & @CRLF & _ "# Near-pangrams (25 letters)" & @CRLF & _ "" & @CRLF & _ "Cwm bank glyphs quiz vext Ford." & @CRLF & _ "Fox nymphs grab quick jive waltz." & @CRLF & _ "Glib jock dwarves vet ox nymph quiz." & @CRLF & _ "Quick zephyrs blow, vexing daft Jon." & @CRLF & _ "How vexingly quick daft zebras pump!" & @CRLF & _ "Ms. Jock, TV quiz PhD, bags few lynx." & @CRLF & _ "Sphinges of black quartz, judge my vow." & @CRLF & _ "The four boxing wizards jump quickly." & @CRLF & _ "Waltz, nymph, or quick jigs vex Bud." & @CRLF & _ "Quick fox jumps nightly over wizard." & @CRLF & _ "Jackdaws love my big quartz sphinx." & @CRLF & _ "Driven jocks help fax my big owl quiz." & @CRLF & _ "Fickle jinx bog dwarves ham spy quiz." & @CRLF & _ "Public junk dwarves hug my quartz ox." & @CRLF & _ "Aw, five quacking zephyrs jolt my bed." & @CRLF & _ "Pack my ox with five dozen liquor jugs." & @CRLF & _ "Sympathizing would nix Quaker objectives." & @CRLF & _ "When zombies arrive at fax, quickly judge." & @CRLF & _ "Waxy jocks quivered and fumbled the pizza." & @CRLF & _ "The quick brown fox jumps over the zany dog." & @CRLF & _ "Exchange woven silk pyjamas for blue quartz." & @CRLF & _ "The jays, pig, fox, zebra and my wolf quack!" & @CRLF & _ "A wizard's job is to quickly finger ex-chumps." & @CRLF & _ "The quirky lazy dwarf jumps over the onyx bling." & @CRLF & _ "Foxy diva Jennifer Lopez was baking my quiche." & @CRLF & _ "Watch "Jeopardy!", Alex Trebek's fun quiz game." & @CRLF & _ "By Jove, my study of quine lexicography won a prize!" & @CRLF & _ "Your girl wove six dozen plaid jackets before she quit." & @CRLF & _ "Grumpy wizards create a toxic brew for the jovial queen." & @CRLF & _ "A quivering Texas zombie fought ink republic jewelry." & @CRLF & _ "The wizard quickly jinxed the gnome before he vaporized." & @CRLF & _ "The judge asked all questions amassed by five watched experts." & @CRLF & _ "Back in May we delivered oxygen equipment of the same size." & @CRLF & _ "She promptly judged antique ivory buckles for the next prize." & @CRLF & _ "Jon quickly realized that the beautiful gowns are expensive." & @CRLF & _ "" & @CRLF & _ "# Near-pangrams (23-24 letters, from MASC wordsense)" & @CRLF & _ "" & @CRLF & _ "Squash has become a popular racket game and facilities are widely available." & @CRLF & _ "Equally coveted is the sexy Y2K logo (named for the millennial computer bug)." & @CRLF & _ "Dole is sorely tempted to forget everything he knows about the 1980s tax cuts." & @CRLF & _ "The officers have been placed on administrative duty while a grand jury examines the case." & @CRLF & _ "Head up the hill above the town to explore the remains of the ancient Greek town of Sybrita." & @CRLF & _ ""I can at least partly save the movie from being wrecked by Herzog's bungling," writes Kinski." & @CRLF & _ "To answer this question, Vygotsky proposed a special concept: the zone of proximal development." Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH) Local $aFullArray[0] For $i = 0 To UBound($aArray) -1 _ArrayConcatenate($aFullArray, $aArray[$i]) Next $aArray = $aFullArray ; 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