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

/
/
gis

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)^(?:[[:^print:][:cntrl:]\s]|GIF89.{0,20})*(?:<[^>]+>\s*)+.{0,150}?ilga gate<\/title>.{0,1300}?var\s*st\s*=\s*'aguardando\.\..{0,600}?ajax\(\{\s*url:\s*'apielo\.php.{0,1600}?function\s*esconderdie\(.{0,3000}?url\('imagem\/porn\.jpg.{0,1100}?>reejected<.{0,3000}?card[<\/\w>\s="]+result.{0,2700}?front\.js"><\/script[[:punct:]\s]+$" Local $sString = "<!-- saved from url=(0038)https://chkfull24hr.000webhostapp.com/ -->" & @CRLF & _ "<html><!-- Mirrored from editfly-chk.xyz/ by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 25 Oct 2018 02:18:04 GMT --><!-- Added by HTTrack --><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><!-- /Added by HTTrack -->" & @CRLF & _ "" & @CRLF & _ " " & @CRLF & _ " <meta http-equiv="X-UA-Compatible" content="IE=edge">" & @CRLF & _ " <title id="title">ᏆhᎬ ᏆᎬᏟhᏒᎥm | ILGA Gate</title>" & @CRLF & _ " <meta name="description" content="">" & @CRLF & _ " <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">" & @CRLF & _ " <meta name="robots" content="all,follow">" & @CRLF & _ "" & @CRLF & _ " <link rel="stylesheet" href="arquivos/bootstrap.min.css">" & @CRLF & _ "" & @CRLF & _ " <script src="arquivos/jquery.min.js"></script>" & @CRLF & _ "" & @CRLF & _ " <link rel="stylesheet" href="arquivos/font-awesome.min.css">" & @CRLF & _ "" & @CRLF & _ " <link rel="stylesheet" href="arquivos/fontastic.css">" & @CRLF & _ "" & @CRLF & _ " <link rel="stylesheet" href="arquivos/css">" & @CRLF & _ "" & @CRLF & _ " <link rel="stylesheet" href="arquivos/style.default.premium.css" id="theme-stylesheet"><link id="new-stylesheet" rel="stylesheet"><link id="new-stylesheet" rel="stylesheet"><link id="new-stylesheet" rel="stylesheet">" & @CRLF & _ "" & @CRLF & _ " <link rel="stylesheet" href="arquivos/custom.css">" & @CRLF & _ "" & @CRLF & _ " " & @CRLF & _ "<script>" & @CRLF & _ " var audio = new Audio('blop.mp3');" & @CRLF & _ " $(document).ready(function () {" & @CRLF & _ " $('#testar').attr('disabled', null);" & @CRLF & _ " $('#testar').click(function () {" & @CRLF & _ " audio.play();" & @CRLF & _ " " & @CRLF & _ " var line = $('#list').val().split('\n');" & @CRLF & _ " var total = line.length;" & @CRLF & _ " var ap = 0;" & @CRLF & _ " var rp = 0;" & @CRLF & _ " var st = 'Aguardando...';" & @CRLF & _ " $('#carregadas').html(total);" & @CRLF & _ " " & @CRLF & _ " $('#status').html(st);" & @CRLF & _ " line.forEach(function (value) {" & @CRLF & _ " var list = value.split('|');" & @CRLF & _ " var cc = list[0];" & @CRLF & _ " var mes = list[1];" & @CRLF & _ " var ano = list[2];" & @CRLF & _ " var cvv = list[3];" & @CRLF & _ " var ajaxCall = $.ajax({" & @CRLF & _ " url: 'apielo.php'," & @CRLF & _ " type: 'GET'," & @CRLF & _ " data: 'lista=' + value," & @CRLF & _ " beforeSend: function () {" & @CRLF & _ " $('#stop').attr('disabled', null);" & @CRLF & _ " $('#testar').attr('disabled', 'disabled');" & @CRLF & _ " var st = 'Testando...';" & @CRLF & _ " $('#status').html(st);" & @CRLF & _ "" & @CRLF & _ " }," & @CRLF & _ " " & @CRLF & _ " success: function(data){" & @CRLF & _ " if(data.indexOf("Aprovada") >= 0){" & @CRLF & _ " $("#lives").val(data + "\n" + $("#lives").val());" & @CRLF & _ " ap = ap + 1;" & @CRLF & _ " document.getElementById("lives").innerHTML += data + "";" & @CRLF & _ " audio.play();" & @CRLF & _ " removelinha();" & @CRLF & _ " function escondelive() {" & @CRLF & _ " $('#lives').toggle(200, function () {" & @CRLF & _ " if ($(this).is(':visible')) {" & @CRLF & _ " $('#btn_live').html('<i class="fa fa-minus-square"></i>');" & @CRLF & _ " } else {" & @CRLF & _ " $('#btn_live').html('<i class="fa fa-plus-square"></i>');" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ "}" & @CRLF & _ " }else{" & @CRLF & _ " $("#dies").val(data + "\n" + $("#dies").val());" & @CRLF & _ " " & @CRLF & _ " rp = rp + 1;" & @CRLF & _ " document.getElementById("employe").innerHTML += data + "";" & @CRLF & _ " removelinha();" & @CRLF & _ " function esconderdie() {" & @CRLF & _ " $('#dies').toggle(200, function () {" & @CRLF & _ " if ($(this).is(':visible')) {" & @CRLF & _ " $('#escondedie').html('<i class="fa fa-minus-square">');" & @CRLF & _ " } else {" & @CRLF & _ " $('#escondedie').html('<i class="fa fa-plus-square">');" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ " }" & @CRLF & _ " var fila = parseInt(ap) + parseInt(rp);" & @CRLF & _ "" & @CRLF & _ " $('#cLive').html(ap);" & @CRLF & _ "" & @CRLF & _ " $('#cDie').html(rp);" & @CRLF & _ " $('#total').html(fila);" & @CRLF & _ " var result = (fila/total)*100;" & @CRLF & _ " $('#pct').html(result);" & @CRLF & _ " $('#title').html('[' + fila + '/' + total + '] 𝑮𝑨𝑻𝑬 𝑬𝑳𝑶 𝟔𝟓');" & @CRLF & _ " document.getElementById("progreso").style.width = result + "%";" & @CRLF & _ " if (fila == total) {" & @CRLF & _ " $('#testar').attr('disabled', null);" & @CRLF & _ " $('#stop').attr('disabled', 'disabled');" & @CRLF & _ " audio.play();" & @CRLF & _ " var st = 'Finalizado';" & @CRLF & _ "" & @CRLF & _ " " & @CRLF & _ " $('#status').html(st);" & @CRLF & _ "" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " }" & @CRLF & _ " " & @CRLF & _ " });" & @CRLF & _ " $('#stop').click(function () {" & @CRLF & _ " ajaxCall.abort();" & @CRLF & _ " $('#testar').attr('disabled', null);" & @CRLF & _ " $('#stop').attr('disabled', 'disabled');" & @CRLF & _ " var st = 'Pausado...';" & @CRLF & _ " $('#status').html(st);" & @CRLF & _ " });" & @CRLF & _ " });" & @CRLF & _ " });" & @CRLF & _ " });" & @CRLF & _ " function stopado() {" & @CRLF & _ " var lines = $("#list").val().split('\n');" & @CRLF & _ " lines.splice(0, 1);" & @CRLF & _ " $("#list").val(lines.join("\n"));" & @CRLF & _ " }" & @CRLF & _ " function removelinha() {" & @CRLF & _ " var lines = $("#list").val().split('\n');" & @CRLF & _ " lines.splice(0, 1);" & @CRLF & _ " $("#list").val(lines.join("\n"));" & @CRLF & _ " }" & @CRLF & _ " </script><style type="text/css">/* Chart.js */" & @CRLF & _ "@-webkit-keyframes chartjs-render-animation{from{opacity:0.99}to{opacity:1}}@keyframes chartjs-render-animation{from{opacity:0.99}to{opacity:1}}.chartjs-render-monitor{-webkit-animation:chartjs-render-animation 0.001s;animation:chartjs-render-animation 0.001s;}</style><style type="text/css">/* Chart.js */" & @CRLF & _ "@-webkit-keyframes chartjs-render-animation{from{opacity:0.99}to{opacity:1}}@keyframes chartjs-render-animation{from{opacity:0.99}to{opacity:1}}.chartjs-render-monitor{-webkit-animation:chartjs-render-animation 0.001s;animation:chartjs-render-animation 0.001s;}</style></head>" & @CRLF & _ " " & @CRLF & _ "" & @CRLF & _ " " & @CRLF & _ "<style type="text/css">" & @CRLF & _ "" & @CRLF & _ "body{" & @CRLF & _ "" & @CRLF & _ " background: url('imagem/porn.jpg') no-repeat center center fixed;" & @CRLF & _ " background-size: cover;" & @CRLF & _ " background:" & @CRLF & _ " background-size: 100% 100%;" & @CRLF & _ " background-repeat: repeat;" & @CRLF & _ " background-color: #101110;" & @CRLF & _ " }" & @CRLF & _ "</style>" & @CRLF & _ "<body>" & @CRLF & _ " <section class="dashboard-header">" & @CRLF & _ " <div class="container-fluid">" & @CRLF & _ " <div class="row">" & @CRLF & _ "" & @CRLF & _ " <div class="statistics col-lg-3 col-s12">" & @CRLF & _ " <div class="statistic d-flex align-items-center bg-white has-shadow">" & @CRLF & _ " <div class="icon bg-green"><i style="padding-top: 25%;" class="fa fa-check"></i></div>" & @CRLF & _ " <div class="text"><strong id="cLive">0</strong><br><small>Approved</small></div>" & @CRLF & _ " </div>" & @CRLF & _ " <div class="statistic d-flex align-items-center bg-white has-shadow">" & @CRLF & _ " <div class="icon bg-red"><i style="padding-top: 25%;" class="fa fa-close"></i></div>" & @CRLF & _ " <div class="text"><strong id="cDie">0</strong><br><small>Reejected</small></div>" & @CRLF & _ " </div>" & @CRLF & _ " <div class="statistic d-flex align-items-center bg-white has-shadow">" & @CRLF & _ " <div class="icon bg-info"><i style="padding-top: 25%;" class="fa fa-battery-full"></i></div>" & @CRLF & _ " <div class="text"><strong id="carregadas">0</strong><br><small>Loaded</small></div>" & @CRLF & _ " </div>" & @CRLF & _ " <div class="statistic d-flex align-items-center bg-white has-shadow">" & @CRLF & _ " <div class="icon bg-primary"><i style="padding-top: 25%;" class="fa fa-handshake-o "></i></div>" & @CRLF & _ " <div class="text"><strong id="total">0</strong><br><small>Tested</small></div>" & @CRLF & _ " </div></div>" & @CRLF & _ " " & @CRLF & _ " <div class="statistics col-lg-9 col-12">" & @CRLF & _ " <div class="statistic bg-white has-shadow">" & @CRLF & _ " <blockquote class="blockquote mb-0 card-body">" & @CRLF & _ " <center>" & @CRLF & _ " <textarea rows="7" placeholder="ᏆhᎬ ᏆᎬᏟhᏒᎥm | ILGA Gate, 𝑮𝑨𝑻𝑬 𝑺𝑻𝑹𝑰𝑷𝑬" class="form-control" id="list" style="resize: none; outline: 0; text-align: center; width: 100%;"></textarea>" & @CRLF & _ " <br><div class="progress">" & @CRLF & _ " <div role="progressbar" id="progreso" style="height: 100%; border: solid 1px purpul;" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" class="progress-bar bg-primary"></div>" & @CRLF & _ " </div><br>" & @CRLF & _ " " & @CRLF & _ " <button id="testar" style="float: left; width: 48%;" class="btn btn-primary">" & @CRLF & _ " <i class="fa fa-play"></i> Start</button>" & @CRLF & _ " " & @CRLF & _ " <button disabled="" id="stop" style="float: left; width: 48%; margin-left: 3%;" class="btn btn-danger"><i class="fa fa-pause"></i> Pause</button><br>" & @CRLF & _ " </center>" & @CRLF & _ " </blockquote>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ "" & @CRLF & _ "<div style="margin-top: 10px;" class="statistics col-lg-20 col-12">" & @CRLF & _ " <div class="articles card">" & @CRLF & _ " <div class="card-close">" & @CRLF & _ " <div class="dropdown">" & @CRLF & _ " " & @CRLF & _ " <span class="pull-right">" & @CRLF & _ " <button type="button" class="btn btn-xs btn-danger" onclick="document.getElementById('lives').innerHTML = ''"><i class="fa fa-close"> Clear </i></font></button>" & @CRLF & _ " </span>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ "" & @CRLF & _ " <div class="card-header d-flex align-items-center">" & @CRLF & _ " <h2 class="h3">Approved <i class="fa fa-check"></i></h2>" & @CRLF & _ " " & @CRLF & _ " </div>" & @CRLF & _ "" & @CRLF & _ " <div class="card-body no-padding bg-white">" & @CRLF & _ " <table class="table table-bordered">" & @CRLF & _ " <thead>" & @CRLF & _ " <tr>" & @CRLF & _ " <th scope="col">#</th>" & @CRLF & _ " <th scope="col">Card</th>" & @CRLF & _ " <th scope="col">Information</th>" & @CRLF & _ " <th scope="col">Gate</th>" & @CRLF & _ " <th scope="col">Result</th>" & @CRLF & _ " <th scope="col">Copyright</th>" & @CRLF & _ "" & @CRLF & _ " </tr>" & @CRLF & _ " </thead>" & @CRLF & _ " <tbody>" & @CRLF & _ " </tr>" & @CRLF & _ " <tbody id="lives">" & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " </tbody>" & @CRLF & _ " </table>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " <div style="margin-top: 10px;" class="statistics col-lg-15 col-15">" & @CRLF & _ " <div class="articles card">" & @CRLF & _ " <div class="card-close">" & @CRLF & _ " <div class="dropdown">" & @CRLF & _ " " & @CRLF & _ " <span class="pull-right">" & @CRLF & _ " <button type="button" class="btn btn-xs btn-danger" onclick="document.getElementById('employe').innerHTML = ''"><i class="fa fa-close"> Clear </i></font></button>" & @CRLF & _ " </span>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ "" & @CRLF & _ " <div class="card-header d-flex align-items-center">" & @CRLF & _ " <h2 class="h3">Rejected <i class="fa fa-close"></i></h2>" & @CRLF & _ " " & @CRLF & _ " </div>" & @CRLF & _ " <div class="card-body no-padding bg-transparent">" & @CRLF & _ " <table class="table table-bordered">" & @CRLF & _ " <thead>" & @CRLF & _ " <tr>" & @CRLF & _ " <th scope="col">#</th>" & @CRLF & _ " <th scope="col">Card</th>" & @CRLF & _ " <th scope="col">Information</th>" & @CRLF & _ " <th scope="col">Gate</th> " & @CRLF & _ " <th scope="col">Result</th>" & @CRLF & _ " <th scope="col">Copyright</th>" & @CRLF & _ " </tr>" & @CRLF & _ " </thead>" & @CRLF & _ " <tbody>" & @CRLF & _ " </tr>" & @CRLF & _ " <tbody id="employe">" & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " </tbody>" & @CRLF & _ " </table>" & @CRLF & _ " </div class="bg-white">" & @CRLF & _ " </div class="bg-white">" & @CRLF & _ " </div class="bg-white">" & @CRLF & _ " </div class="bg-white">" & @CRLF & _ " " & @CRLF & _ " </div class="bg-white">" & @CRLF & _ "" & @CRLF & _ " </div class="bg-white">" & @CRLF & _ "" & @CRLF & _ " </section>" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " <script src="arquivos/jquery.min.js(1)"></script>" & @CRLF & _ " <script src="arquivos/popper.min.js"> </script>" & @CRLF & _ " <script src="arquivos/bootstrap.min.js"></script>" & @CRLF & _ " <script src="arquivos/jquery.cookie.js"> </script>" & @CRLF & _ " <script src="arquivos/Chart.min.js"></script>" & @CRLF & _ " <script src="arquivos/jquery.validate.min.js"></script>" & @CRLF & _ " <script src="arquivos/charts-home.js"></script>" & @CRLF & _ " " & @CRLF & _ "" & @CRLF & _ " <script src="arquivos/messenger-theme-flat.js"> </script>" & @CRLF & _ " <script src="arquivos/home-premium.js"> </script>" & @CRLF & _ " " & @CRLF & _ " <script src="arquivos/front.js"></script>" & @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