Regular Expressions 101

Save & Manage Regex

  • Current Version: 11
  • 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
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
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 = "(?uU)(?:[(|\s';",=])((?:http|\/|\\){1}(?:[\/:,~\\.\-\–\d_@%A-Za-z\p{L}\p{M}\p{N}]{10,}\.(?:jpg|jpeg|jpe|png|webp|svg|gif|css|js)))(?=(?:|\?|"|&|,|\s|'|\)|\||\\|}))" Local $sString = " <p custom-attr=http://example.org/wp-content/uploads/2018/05/brands.png>" & @CRLF & _ "" & @CRLF & _ " [16] => https://www.mueblesexpress.com.uy/wp-content/plugins/divi-bars/assets/js/snap.svg-min.js" & @CRLF & _ "" & @CRLF & _ "/wp-content/plugins/optimole-wp/assets/img/log4.pngRANDOMSTUFF" & @CRLF & _ "" & @CRLF & _ "http://96e363596fbe.ngrok.io/wp-includes/js/hoverintent-js.min.png-random.css" & @CRLF & _ "" & @CRLF & _ "http://example.org/wp-includes/js/assets/whatever.jpg.png.css.js ';" & @CRLF & _ "" & @CRLF & _ "http://example.org/wp-content/themes/test/assets/images/header.pnghttps://example.org/wp-content/themes/test/assets/images/header.png " & @CRLF & _ "" & @CRLF & _ "http://example.org/wp-content/themes/test/assets/images/header.pnghttp://example.org/wp-content/themes/test/assets/images/header.png " & @CRLF & _ "" & @CRLF & _ "https://test123.i.optimole.com/F7bDy7k-fXTTyV95/f:js/q:auto/m:0/http://example.org/wp-content/plugins/images/img.jpg" & @CRLF & _ "" & @CRLF & _ " [17] => http://96e363596fbe.ngrok.io/wp-includes/js/hoverintent-js.min.js" & @CRLF & _ " [18] => http://96e363596fbe.ngrok.io/wp-includes/js/admin-bar.min.js" & @CRLF & _ " [19] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/jquery-blockui/jquery.blockUI.min.js" & @CRLF & _ " [20] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js" & @CRLF & _ " [21] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/js-cookie/js.cookie.min.js" & @CRLF & _ " [22] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/frontend/woocommerce.min.js" & @CRLF & _ " [23] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.min.js" & @CRLF & _ " [24] => http://96e363596fbe.ngrok.io/wp-content/plugins/smart-search-for-woocommerce/assets/js/se-widgets.js" & @CRLF & _ " [25] => http://96e363596fbe.ngrok.io/wp-content/themes/twentynineteen/js/priority-menu.js" & @CRLF & _ " [26] => http://96e363596fbe.ngrok.io/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js" & @CRLF & _ " [27] => http://96e363596fbe.ngrok.io/wp-includes/js/wp-embed.min.js" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "http://example.org/wp-content/themes/test/assets/images/header.png " & @CRLF & _ " http://example.org/wp-content/themes/test/assets/images/header.jpeg" & @CRLF & _ "http://example.org/wp-content/plugins/optimole-wp/assets/img/logo1.png " & @CRLF & _ " http://example.org/wp-content/plugins/optimole-wp/assets/img/logo2.png?width=500&cr=small" & @CRLF & _ " http://example.org/wp-content/plugins/optimole-wp/assets/img/logo3.png%3Fwidth%3D500%26cr%3Dsmall" & @CRLF & _ " http://example.org/wp-content/uploads/2018/05/umlauts_image_äöü.jpg" & @CRLF & _ " http://example.org/uploads/2018/05/umlauts_image_a\u0308o\u0308u\u0308.jpg" & @CRLF & _ " //example.org/wp-content/themes/test/assets/images/header2.png " & @CRLF & _ " //example.org/wp-content/themes/test/assets/images/header2.jpeg" & @CRLF & _ " //example.org/wp-content/plugins/optimole-wp/assets/img/logo4.png " & @CRLF & _ " //example.org/wp-content/plugins/optimole-wp/assets/img/logo2.png?width=500&cr=small" & @CRLF & _ " //example.org/wp-content/plugins/optimole-wp/assets/img/logo3.png%3Fwidth%3D500%26cr%3Dsmall" & @CRLF & _ " //example.org/wp-content/uploads/2018/05/umlauts_im4age_äöü.jpg" & @CRLF & _ " //example.org/uploads/2018/05/umlauts_5image_a\u0308o\u0308u\u0308.jpg" & @CRLF & _ " /wp-content/themes/test/assets/images/header4.png " & @CRLF & _ " /wp-content/themes/test/assets/images/header7.jpeg" & @CRLF & _ " /wp-content/plugins/optimole-wp/assets/img/logo9.png " & @CRLF & _ " /wp-content/plugins/optimole-wp/assets/img/lo2go.png?width=500&cr=small" & @CRLF & _ " /wp-content/plugins/optimole-wp/assets/img/log4.png%3Fwidth%3D500%26cr%3Dsmall" & @CRLF & _ " " & @CRLF & _ " /wp-content/uploads/2018/05/umlau1ts_image_äöü.jpg" & @CRLF & _ "" & @CRLF & _ " /wp-content/uploads/2018/05/umlau1ts_image_a\u0308o\u0308u\u0308.jpg" 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