Regular Expressions 101

Save & Manage Regex

  • Current Version: 2
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
Sponsors
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]
  • 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
Processing...

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 = "(<p class="headline light")[\s\S]*<\/p>" Local $sString = "</table>" & @CRLF & _ "</div>" & @CRLF & _ "<div>" & @CRLF & _ "<table class="row" style="border-spacing:0;border-collapse:collapse;text-align:left;vertical-align:top;padding:0;width:100%;position:relative;display:table">" & @CRLF & _ " <tr class="" style="padding:0;vertical-align:top;text-align:left">" & @CRLF & _ " <th class="small-12 large-12 columns first last" style="font-size:16px;padding:0;text-align:left;color:#0a0a0a;font-family:'Circular', Helvetica, Arial, sans-serif;font-weight:normal;line-height:1.3;margin:0 auto;padding-bottom:16px;width:564px;padding-left:16px;padding-right:16px">" & @CRLF & _ " <a href="https://www.airbnb.com/rooms/show?euid=c4130567-c3af-eb6e-605b-76a13688cf5d&amp;id=12670046" style="font-family:'Circular', Helvetica, Arial, sans-serif;font-weight:normal;padding:0;margin:0;text-align:left;line-height:1.3;color:#2199e8;text-decoration:none">" & @CRLF & _ " <img src="https://a0.muscache.com/im/pictures/2633deb9-ebbd-4dcb-b0f5-44d840636280.jpg?aki_policy=large" class="row-pad-bot-1" style="display:block;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic;width:auto;clear:both;max-width:100%;border:none;padding-bottom:8px !important">" & @CRLF & _ " </a>" & @CRLF & _ " </th>" & @CRLF & _ " </tr>" & @CRLF & _ "</table>" & @CRLF & _ "<table class="row destination-card" style="border-spacing:0;border-collapse:collapse;text-align:left;vertical-align:top;padding:0;width:100%;position:relative;display:table">" & @CRLF & _ " <tr style="padding:0;vertical-align:top;text-align:left">" & @CRLF & _ " <th class="small-12 large-12 columns first destination-card-text row-pad-bot-3" style="font-size:16px;line-height:1.3;color:#0a0a0a;font-family:'Circular', Helvetica, Arial, sans-serif;font-weight:normal;padding:0;text-align:left;padding-right:8px;margin:0 auto;padding-bottom:16px;width:564px;padding-left:16px">" & @CRLF & _ " <a href="https://www.airbnb.com/rooms/show?euid=c4130567-c3af-eb6e-605b-76a13688cf5d&amp;id=12670046" style="font-family:'Circular', Helvetica, Arial, sans-serif;font-weight:normal;padding:0;margin:0;text-align:left;line-height:1.3;color:#2199e8;text-decoration:none">" & @CRLF & _ " <p class="headline light" style='padding:0;margin:0;text-align:left;font-weight:300;-ms-hyphens:none;word-break:keep-all;hyphens:none;-webkit-hyphens:none;-moz-hyphens:none;color:#484848;font-family:"Circular", "Helvetica", Helvetica, Arial, sans-serif;font-size:24px;line-height:1.3;margin-bottom:0 !important'>" & @CRLF & _ " The Shala - Sunset Room ›" & @CRLF & _ " </p>" & @CRLF & _ " <p class="subheadline light" style='padding:0;margin:0;text-align:left;margin-bottom:10px;font-weight:300;font-family:"Circular", "Helvetica", Helvetica, Arial, sans-serif;color:#484848;font-size:18px;line-height:1.4;padding-top:4px'>" & @CRLF & _ " Private room" & @CRLF & _ " </p>" & @CRLF & _ " </a>" & @CRLF & _ " </th>" & @CRLF & _ " </tr>" & @CRLF & _ "</table>" & @CRLF & _ "</div>" & @CRLF & _ "<div>" & @CRLF & _ "" 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