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

/
/
g

Test String

Substitution

Processing...

Code Generator

Generated Code

#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox Local $sRegex = "https?\:\/\/(www.)?([a-z\.A-Z\-]+)\/.*" Local $sString = "https://thenextweb.com/dd/2014/04/08/ux-designers-side-drawer-navigation-costing-half-user-engagement/" & @CRLF & _ "https://developer.android.com/training/implementing-navigation/nav-drawer.html" & @CRLF & _ "http://www.viralandroid.com/2015/09/android-sliding-menu-with-webview.html" & @CRLF & _ "https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uac…Android&usg=AFQjCNFRk6d5AhBfonGM106Sad2tjoBT7g&sig2=kiMOjbXGWDcWRLpLOvyYQQ" & @CRLF & _ "https://github.com/twbs/bootstrap/issues/4550" & @CRLF & _ "https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=6&cad=rja&uac…ypes%2F&usg=AFQjCNHRDjZYkePYfSuVIkV9e4XLWM0V_g&sig2=_jN849JNw4Zbp2s3Anlzgw" & @CRLF & _ "http://stackoverflow.com/questions/24463890/open-webview-when-item-in-the-side-slide-menu-is-clicked" & @CRLF & _ "https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=8&cad=rja&uac…s-popup&usg=AFQjCNFtDDELoRlF3_9SuoyJJ2kzZsDrDw&sig2=54H1u1WQd2NG0aywd6G4SQ" & @CRLF & _ "https://support.proto.io/hc/en-us/community/posts/207856878-Sliding-sidebar-menu-s-links-do-not-work-on-Android-app" & @CRLF & _ "https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=10&cad=rja&ua…b265b49&usg=AFQjCNEgo2JyzndfiLfH9duieqVd71CsVA&sig2=txF-3ZgdzHydpJJJ2BwT5Q" & @CRLF & _ "https://developer.chrome.com/multidevice/android/customtabs" & @CRLF & _ "http://www.howtogeek.com/237951/how-to-add-website-links-to-the-windows-10-start-menu/" & @CRLF & _ "https://paul.kinlan.me/deep-app-linking-on-android-and-chrome/" & @CRLF & _ "https://developers.google.com/apps-script/guides/dialogs" & @CRLF & _ "https://material.io/guidelines/patterns/navigation-drawer.html" & @CRLF & _ "https://help.shopify.com/manual/sell-online/online-store/menus-and-links" & @CRLF & _ "https://books.google.com/books?id=IAVnDQAAQBAJ&pg=PT129&lpg=PT129&dq=androi…PsnBph0QJXDzjUY&hl=en&sa=X&ved=0ahUKEwi5_6G-9pXSAhXHurwKHc6RCQEQ6AEIgwEwEA" & @CRLF & _ "https://lmjabreu.com/post/why-and-how-to-avoid-hamburger-menus" & @CRLF & _ "http://stacktips.com/tutorials/android/navigation-drawer-android-example" & @CRLF & _ "https://www.npmjs.com/package/cordova-universal-links-plugin" & @CRLF & _ "https://support.wunderlist.com/customer/portal/articles/1767713" & @CRLF & _ "https://www.thepolyglotdeveloper.com/2014/12/open-dynamic-links-using-cordova-inappbrowser/" & @CRLF & _ "http://www.infoworld.com/article/2610416/web-browsers/web-browsers-50-tips-and-tricks-for-chrome-power-users.html" & @CRLF & _ "https://vivaldi.com/?lang=en_US" & @CRLF & _ "http://www.androidpolice.com/2016/01/20/google-android-app-can-now-open-links-in-chrome-custom-tabs-after-latest-update/" & @CRLF & _ "https://forum.ionicframework.com/t/external-links-in-side-menu-not-working/58384" & @CRLF & _ "http://dolphin.com/dolphin-for-android-phone-faqs/" & @CRLF & _ "https://www.facebook.com/business/help/312169205649942" & @CRLF & _ "http://blog.teamtreehouse.com/add-navigation-drawer-android" & @CRLF & _ "http://forums.androidcentral.com/android-apps/593611-how-force-android-open-facebook-links-facebook-app.html" & @CRLF & _ "https://plaid.com/docs/quickstart/" & @CRLF & _ "https://motorola-global-portal.custhelp.com/app/answers/prod_answer_detail/a_id/109551/p/30,6720,9583" & @CRLF & _ "http://blog.ionic.io/deeplinking-in-ionic-apps/" & @CRLF & _ "https://help.evernote.com/hc/en-us/articles/209004637-How-to-create-shortcuts-for-frequently-accessed-notes-notebooks-and-searches" & @CRLF & _ "http://www.jqueryscript.net/tags.php?/side%20menu/" & @CRLF & _ "https://community.box.com/t5/Account-Information/How-To-Disable-Plugins-Add-Ons-Extensions-In-Multiple-Browsers/ta-p/19" & @CRLF & _ "https://support.mozilla.org/en-US/kb/using-tabs-firefox-android" & @CRLF & _ "http://semantic-ui.com/modules/sidebar.html" & @CRLF & _ "https://docs.citrix.com/en-us/xenmobile-apps/10/secure-web.html" & @CRLF & _ "https://www.cnet.com/how-to/how-to-request-desktop-version-of-a-web-site-in-chrome-for-android/" & @CRLF & _ "http://mmenu.frebsite.nl/" & @CRLF & _ "http://tiddlywiki.com/" & @CRLF & _ "http://callmenick.com/post/slide-and-push-menus-with-css3-transitions" & @CRLF & _ "https://www.lullabot.com/articles/navigation-and-deep-linking-with-react-native" & @CRLF & _ "http://www.computerworld.com/article/2474114/android/4-hidden-settings-to-make-chrome-for-android-even-better.html" & @CRLF & _ "http://help.tune.com/marketing-console/creating-and-using-deeplink-urls/" & @CRLF & _ "https://codepen.io/zavoloklom/pen/dIgco" & @CRLF & _ "https://www.smashingmagazine.com/2012/06/responsive-menus-enhancing-navigation-on-mobile-websites/" & @CRLF & _ "https://get.slack.help/hc/en-us/articles/205166337-Customize-your-Slack-theme" & @CRLF & _ "https://code.tutsplus.com/tutorials/mobile-web-quick-tip-phone-number-links--mobile-7667" Local $sSubst = "$2" Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst) MsgBox($MB_SYSTEMMODAL, "Result", $sResult)

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