Regular Expressions 101

Save & Share

  • Regex Version: ver. 12
  • 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
No Match

r"
"
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)(?!letsgo\.|shop\.|advertise\.|static\.|www\.)((\w|-)+\.)(tumblr\.com|tmblr\.co)\/?(?!\S)" Local $sString = "Match the following:" & @CRLF & _ "https://dhabitahpunk-art.tumblr.com/" & @CRLF & _ "https://cdn.tumblr.com" & @CRLF & _ "" & @CRLF & _ "DON'T match the following:" & @CRLF & _ "https://www.tumblr.com/todayontumblr" & @CRLF & _ "tumblr.com/todayontumblr" & @CRLF & _ "https://www.tumblr.com/todayontumblr/" & @CRLF & _ "tumblr.com/todayontumblr/" & @CRLF & _ "https://www.tumblr.com/dhabitahpunk-art" & @CRLF & _ "tumblr.com/dhabitahpunk-art" & @CRLF & _ "https://www.tumblr.com/dhabitahpunk-art/" & @CRLF & _ "tumblr.com/dhabitahpunk-art/" & @CRLF & _ "https://tmblr.co/MzB5rhaOrTp3uwB5NhcQsEw" & @CRLF & _ "https://www.tumblr.com/blog/view/grouper/" & @CRLF & _ "https://www.tumblr.com/internships" & @CRLF & _ "https://www.tumblr.com/transparency" & @CRLF & _ "https://www.tumblr.com/search/lana" & @CRLF & _ "https://www.tumblr.com/tagged/lwaxana%20troi?sort=top" & @CRLF & _ "https://www.tumblr.com/following" & @CRLF & _ "https://tumblr.com/customize/" & @CRLF & _ "https://letsgo.tumblr.com/" & @CRLF & _ "https://letsgo.tumblr.com/welcome-guide" & @CRLF & _ "https://64.media.tumblr.com/6c05087e5dbaccedf651d421148dfaa0/e7eb8d73a9a6cc70-8e/s540x810/e9cc402adacca3e983fc0448b94919b9f809c719.gifv" & @CRLF & _ "https://shop.tumblr.com/" & @CRLF & _ "https://shop.tumblr.com/new/" & @CRLF & _ "https://www.tumblr.com/tumblrmart/blue-checkmark" & @CRLF & _ "https://help.tumblr.com/hc/articles/115001572547" & @CRLF & _ "https://help.tumblr.com/hc" & @CRLF & _ "https://tumblr.com/help" & @CRLF & _ "https://api.tumblr.com/console" & @CRLF & _ "https://www.tumblr.com/oauth/apps" & @CRLF & _ "https://www.tumblr.com/api" & @CRLF & _ "https://assets.tumblr.com/downloads" & @CRLF & _ "https://www.tumblr.com/abuse" & @CRLF & _ "https://www.tumblr.com/themes/" & @CRLF & _ "https://www.tumblr.com/themes/tagged/two_column" & @CRLF & _ "https://www.tumblr.com/dmca" & @CRLF & _ "https://www.tumblr.com/docs/api_agreement" & @CRLF & _ "https://www.tumblr.com/account/delete" & @CRLF & _ "https://www.tumblr.com/settings" & @CRLF & _ "https://www.tumblr.com/settings/blog" & @CRLF & _ "https://www.tumblr.com/security" & @CRLF & _ "https://www.tumblr.com/developers" & @CRLF & _ "https://www.tumblr.com/press" & @CRLF & _ "https://www.tumblr.com/buttons" & @CRLF & _ "https://www.tumblr.com/logo" & @CRLF & _ "https://www.tumblr.com/tips" & @CRLF & _ "https://www.tumblr.com/support" & @CRLF & _ "https://www.tumblr.com/auth" & @CRLF & _ "https://www.tumblr.com/auth/google?redirectTo=undefined" & @CRLF & _ "https://www.tumblr.com/register" & @CRLF & _ "https://www.tumblr.com/register?source=new_to_tumblr" & @CRLF & _ "https://www.tumblr.com/login" & @CRLF & _ "https://www.tumblr.com/login?redirect_to=%2Fexplore%2Ftoday" & @CRLF & _ "https://www.tumblr.com/explore" & @CRLF & _ "https://www.tumblr.com/explore/trending" & @CRLF & _ "https://advertise.tumblr.com/" & @CRLF & _ "https://advertise.tumblr.com/#why" & @CRLF & _ "https://www.tumblr.com/jobs" & @CRLF & _ "https://www.tumblr.com/policy" & @CRLF & _ "https://www.tumblr.com/privacy_policy" & @CRLF & _ "https://www.tumblr.com/policy/privacy" & @CRLF & _ "https://www.tumblr.com/policy/terms-of-service" & @CRLF & _ "https://www.tumblr.com/apps" & @CRLF & _ "https://www.tumblr.com/about" & @CRLF & _ "https://about.tumblr.com/#quick-facts" & @CRLF & _ "https://www.tumblr.com/" & @CRLF & _ "https://www.tumblr.com/dhabitahpunk-art/tagged/Picturesque" & @CRLF & _ "tumblr.com/dhabitahpunk-art/tagged/Picturesque" & @CRLF & _ "tumblr.com" & @CRLF & _ "https://dhabitahpunk-art.tumblr.com/page/2" & @CRLF & _ "dhabitahpunk-art.tumblr.com/page" & @CRLF & _ "https://dhabitahpunk-art.tumblr.com/page/" & @CRLF & _ "https://dhabitahpunk-art.tumblr.com/commissions" & @CRLF & _ "https://dhabitahpunk-art.tumblr.com/post/714262490632044544/time-taken-355-hoursreference-unknown" & @CRLF & _ "https://static.tumblr.com/" & @CRLF & _ "https://static.tumblr.com/zyubucd/CIjopeea7/transparencyreport2016b.pdf" 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