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

/
/
gm

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 = "(?m)^(?:[a-z\d][a-z\d_-]*[a-z\d])(?:\.(?:[a-z\d][a-z\d_-]*[a-z\d]))*@(?:\d*[a-z]{2,}\d*)+\.(?:\d*[a-z]{2,}\d*)+(?:.(?:\d*[a-z]{2,}\d*)+)*$" Local $sString = "Datos de prueba en el regex101" & @CRLF & _ "jessy2995@hotmail.com" & @CRLF & _ "jessica.altamirano@epn.edu.ec" & @CRLF & _ "carlosfandradev7b@hotmail.com" & @CRLF & _ "carlos.andrade03@epn.edu.ec" & @CRLF & _ "gracegbm@hotmail.es" & @CRLF & _ "grace.borja@epn.edu.ec" & @CRLF & _ "jose-andes15@hotmail.com" & @CRLF & _ "jose.canar@epn.edu.ec" & @CRLF & _ "fabrizzio40@hotmail.com" & @CRLF & _ "fabrizzio.capito@epn.edu.ec" & @CRLF & _ "alexstv001@gmail.com" & @CRLF & _ "alex.carrillo@epn.edu.ec" & @CRLF & _ "caro.cerezor@gmail.com" & @CRLF & _ "johanna.cerezo@epn.edu.ec" & @CRLF & _ "franco_chopan@live.com" & @CRLF & _ "francisco.cevallos01@epn.edu.ec" & @CRLF & _ "steandres_94@yahoo.com" & @CRLF & _ "estefan.cevallos@epn.edu.ec" & @CRLF & _ "jairocka00@hotmail.com" & @CRLF & _ "jairo.chancusig@epn.edu.ec" & @CRLF & _ "alexcuentasnna@gmail.com" & @CRLF & _ "freddy.coronel@epn.edu.ec" & @CRLF & _ "david3505@hotmail.com" & @CRLF & _ "david.cruz@epn.edu.ec" & @CRLF & _ "fabio-a1514@hotmail.com" & @CRLF & _ "fabio.enriquez@epn.edu.ec" & @CRLF & _ "jordy.lig@gmail.com" & @CRLF & _ "jordy.flor@epn.edu.ec" & @CRLF & _ "burmamachoy@hotmail.com" & @CRLF & _ "jose.garcia01@epn.edu.ec" & @CRLF & _ "bryangavilema@gmail.com" & @CRLF & _ "bryan.gavilema@epn.edu.ec" & @CRLF & _ "edwin.paul.73@gmail.com" & @CRLF & _ "edwin.guamushig@epn.edu.ec" & @CRLF & _ "dannylexuz@gmail.com" & @CRLF & _ "danny.herrera@epn.edu.ec" & @CRLF & _ "aaron_hidalgo23@hotmail.com" & @CRLF & _ "aaron.hidalgo@epn.edu.ec" & @CRLF & _ "xavi18rod@gmail.com" & @CRLF & _ "rodman.iniguez@epn.edu.ec" & @CRLF & _ "jairomanzaba@hotmail.com" & @CRLF & _ "jhon.manzaba@epn.edu.ec" & @CRLF & _ "andhy_mosquera@hotmail.com" & @CRLF & _ "andy.mosquera@epn.edu.ec" & @CRLF & _ "jose719810@hotmail.com" & @CRLF & _ "jose.murillo01@epn.edu.ec" & @CRLF & _ "veronica_198825@hotmail.com" & @CRLF & _ "veronica.olmedo@epn.edu.ec" & @CRLF & _ "pato18djul@gmail.com" & @CRLF & _ "marco.parco@epn.edu.ec" & @CRLF & _ "loplaand@hotmail.com" & @CRLF & _ "pablo.pillajo@epn.edu.ec" & @CRLF & _ "diegoaporterol@hotmail.com" & @CRLF & _ "diego.portero@epn.edu.ec" & @CRLF & _ "jl_quilumba@hotmail.com" & @CRLF & _ "jorge.quilumba@epn.edu.ec" & @CRLF & _ "mishellcrm@hotmail.com" & @CRLF & _ "mishell.real@epn.edu.ec" & @CRLF & _ "hpaulsalazar96@hotmail.com" & @CRLF & _ "henry.salazar01@epn.edu.ec" & @CRLF & _ "santiagosarmiento1996@hotmail.com" & @CRLF & _ "santiago.sarmiento@epn.edu.ec" & @CRLF & _ "stalindario96@hotmail.com" & @CRLF & _ "stalin.toaquiza@epn.edu.ec" & @CRLF & _ "andres.liguista@hotmail.com" & @CRLF & _ "bryan.torres01@epn.edu.ec" & @CRLF & _ "alexiscdmovil@live.com" & @CRLF & _ "jonathan.vilatuna@epn.edu.ec" & @CRLF & _ "cristhian.zapata@epn.edu.ec" & @CRLF & _ "jordansalazar17@hotmail.co11.ec" & @CRLF & _ "cris_777_666@yahoo.com" & @CRLF & _ "777_666@ya8ho8ou.com" & @CRLF & _ "" & @CRLF & _ "Correo electrónico inválido" & @CRLF & _ "cristh_slbf_@hotmail.com" & @CRLF & _ "777_666@y6ahoo.com" & @CRLF & _ "alphanumerico" & @CRLF & _ "alphanum.@alphanumo@gmail.com" & @CRLF & _ "alphanumerico@.com.my" & @CRLF & _ "alphanum.erico@c.om.my" & @CRLF & _ "alphanumerico123@gmail.a" & @CRLF & _ "alphanumerico@gmail.com.c1a" & @CRLF & _ ".alphanumerico@alphanumerico.com" & @CRLF & _ "alphanumerico.@alphanumerico.com" & @CRLF & _ "a~l!p<h>(a)u$n%m^e*r[i]c{o} @tj.ec" & @CRLF & _ "alphanumerico@gm*ail.co%m" & @CRLF & _ "alphanumerico@-gm_ail.co-m" & @CRLF & _ "alphanumerico..2002@gmail.com" & @CRLF & _ "alphanumerico@gmail.com." & @CRLF & _ "" 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