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
No Match

r"
"
g

Test String

Code Generator

Generated Code

package main import ( "regexp" "fmt" ) func main() { var re = regexp.MustCompile(`([a-z]+\.){2,}[a-z]+`) var str = `# 🧩 ReVanced Patches Official patches by ReVanced ## 📜 List of available patches ### 📦 \`com.twitter.android\` <details> | 💊 Patch | 📜 Description | 🏹 Target Version | |:--------:|:--------------:|:-----------------:| | \`timeline-ads\` | Removes ads from the Twitter timeline. | all | </details> ### 📦 \`com.reddit.frontpage\` <details> | 💊 Patch | 📜 Description | 🏹 Target Version | |:--------:|:--------------:|:-----------------:| | \`general-reddit-ads\` | Removes general ads from the Reddit frontpage and subreddits. | all | </details> ### 📦 \`com.garzotto.pflotsh.ecmwf_a\` <details> | 💊 Patch | 📜 Description | 🏹 Target Version | |:--------:|:--------------:|:-----------------:| | \`pflotsh-ecmwf-subscription-unlock\` | Unlocks all subscription features. | 3.5.4 | </details> ### 📦 \`com.google.android.apps.youtube.music\` <details> | 💊 Patch | 📜 Description | 🏹 Target Version | |:--------:|:--------------:|:-----------------:| | \`minimized-playback-music\` | Enables minimized playback on Kids music. | 5.17.51 | | \`tasteBuilder-remover\` | Removes the "Tell us which artists you like" card from the home screen. | 5.16.51 | | \`hide-get-premium\` | Removes all "Get Premium" evidences from the avatar menu. | 5.17.51 | | \`compact-header\` | Hides the music category bar at the top of the homepage. | 5.16.51 | | \`upgrade-button-remover\` | Removes the upgrade tab from the pivot bar. | 5.17.51 | | \`background-play\` | Enables playing music in the background. | 5.17.51 | | \`music-microg-support\` | Allows YouTube Music ReVanced to run without root and under a different package name. | 5.17.51 | | \`music-video-ads\` | Removes ads in the music player. | 5.17.51 | | \`codecs-unlock\` | Adds more audio codec options. The new audio codecs usually result in better audio quality. | 5.17.51 | | \`exclusive-audio-playback\` | Enables the option to play music without video. | 5.17.51 | </details> ### 📦 \`de.dwd.warnapp\` <details> | 💊 Patch | 📜 Description | 🏹 Target Version | |:--------:|:--------------:|:-----------------:| | \`promo-code-unlock\` | Disables the validation of promo code. Any code will work to unlock all features. | all | </details> ### 📦 \`com.ss.android.ugc.trill\` <details> | 💊 Patch | 📜 Description | 🏹 Target Version | |:--------:|:--------------:|:-----------------:| | \`tiktok-ads\` | Removes ads from TikTok. | all | </details> ### 📦 \`com.google.android.youtube\` <details> | 💊 Patch | 📜 Description | 🏹 Target Version | |:--------:|:--------------:|:-----------------:| | \`swipe-controls\` | Adds volume and brightness swipe controls. | 17.29.34 | | \`seekbar-tapping\` | Enables tap-to-seek on the seekbar of the video player. | 17.29.34 | | \`minimized-playback\` | Enables minimized and background playback. | 17.29.34 | | \`amoled\` | Enables pure black theme. | 17.29.34 | | \`disable-create-button\` | Hides the create button in the navigation bar. | 17.29.34 | | \`hide-cast-button\` | Hides the cast button in the video player. | all | | \`return-youtube-dislike\` | Shows the dislike count of videos using the Return YouTube Dislike API. | 17.29.34 | | \`hide-autoplay-button\` | Hides the autoplay button in the video player. | 17.29.34 | | \`premium-heading\` | Shows premium branding on the home screen. | all | | \`custom-branding\` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all | | \`disable-fullscreen-panels\` | Disables video description and comments panel in fullscreen view. | 17.29.34 | | \`old-quality-layout\` | Enables the original quality flyout menu. | 17.29.34 | | \`hide-shorts-button\` | Hides the shorts button on the navigation bar. | 17.29.34 | | \`hide-watermark\` | Hides creator's watermarks on videos. | 17.29.34 | | \`sponsorblock\` | Integrate SponsorBlock. | 17.29.34 | | \`enable-wide-searchbar\` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.29.34 | | \`tablet-mini-player\` | Enables the tablet mini player layout. | 17.29.34 | | \`custom-video-buffer\` | Lets you change the buffers of videos. | 17.29.34 | | \`always-autorepeat\` | Always repeats the playing video again. | 17.29.34 | | \`microg-support\` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG | 17.29.34 | | \`settings\` | Adds settings for ReVanced to YouTube. | all | | \`enable-debugging\` | Enables app debugging by patching the manifest file. | all | | \`custom-playback-speed\` | Adds more video playback speed options. | 17.29.34 | | \`hdr-auto-brightness\` | Makes the brightness of HDR videos follow the system default. | 17.29.34 | | \`remember-video-quality\` | Adds the ability to remember the video quality you chose in the video quality flyout. | 17.29.34 | | \`video-ads\` | Removes ads in the video player. | 17.29.34 | | \`general-ads\` | Removes general ads. | 17.29.34 | | \`hide-infocard-suggestions\` | Hides infocards in videos. | 17.29.34 | </details> ` for i, match := range re.FindAllString(str, -1) { fmt.Println(match, "found at index", i) } }

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 Golang, please visit: https://golang.org/pkg/regexp/