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

Code Generator

Generated Code

$re = '/(see|find|sen(d|t)) (\w+ ){0,5}screenshots?/'; $str = 'Hey all,\\n\\nI think I can provide some more info here.\\n\\nFor #1: here is a link @Support you can test with: https://bnc.lt/uqdn/x2A9TH81vt ( https://urldefense.proofpoint.com/v2/url?u=https-3A__bnc.lt_uqdn_x2A9TH81vt&d=CwMFaQ&c=YYrawzBzzQ5Dj1FwyrpTdA&r=57cozPtDg7Ug6VUw4YTreA&m=zaOPMxxEoEZtsn0sdxWkJY1syTaDpbOqJD07_ts8HWA&s=1KGf8nQur0P-Y3thWIpTT9CMzUCl8w70OOX_jWabbVQ&e= )\\n\\nFor #2: I have tried this link in notes myself and it takes me to the app store even if I have the WNBA app installed.\\n\\nFor #3 and #5: @Edwin and @Neulion can you please send the screenshots to verify that the capabilities tab error is no longer there right before you submit and that the Bundle IDs actually match.\\n\\nBest,\\nSamir. Hi Emmanuel,\\n\\nMy colleague Karen and I were browsing through Modcloth last week and wanted to bring something about the current user experience to your attention hoping to help you guys improve it! More specifically, I wanted to chat with you about ModCloth\'s web-to-app user flow.\\n\\nBelow you\'ll find a screenshot of my most recent experience with ModCloth. You\'ll notice that after install I\'m not taken to the same keychain from the web.\\n\\nHere\'s what the user flow would look like with Branch ( http://branch.io ). This UX has driven a 103% increase in install-to-purchase conversion for Jet.com compared to the former:\\n\\nFor some context on Branch, our core focus is driving users with the best possible experience to app content. Our links can live anywhere -- web, emails, social, sharing, and ads -- and provide attribution on where your installs are coming from.\\n\\nWould love to hop on a quick call with you and discuss the opportunity to help. We\'re highly recommended by mobile-first companies that use Branch, including Airbnb, Jet, and Pinterest.\\n\\nLet me know if you\'re free to connect this upcoming week.\\n\\nCheers!\\nFelipe\\n\\nFelipe Noguerol / Partner Growth / Branch Metrics ( http://www.branch.io/ )\\n\\n2443 Ash St, Palo Alto, CA\\nw branch.io ( https://branch.io/?bmp=s-mm ) | c 954-798-7151 | e felipe ( felipe@branch.i )@branch.io ( felipe@branch.io )\\n\\nI\'m here to help, not to pester. If you\'d prefer to not receive these emails, click here ( https://app1b.outreach.io/api/mailings/207637/unsubscribe?org=8f1b7396-04ba-11e6-940a-02c9a687c33b&sig=TLZG9aK0b_eFGoNYG_ugsDjIdBkdqWZOIHKCeSPTI2Y%3D ). Hi Caroline!\\nFor question 1 - Austin\'s exactly right, right now you\'re seeing a bunch of zeros because web sessions did not result in app opens or downloads but once you are comparing downstream events like purchases, you\'ll be able to see side by side. Right now the \\"slice by platform\\" checkbox is not super intuitive but we are doing an analytics revamp and this feature will definitely be updated at that point!\\nFor question 2 - when on the summary page are you looking at click flow? If so, what filters do you have on? Are you filtering by channel = app banner? And date range = 30 days? If you can send me some screenshots of the discrepancy I can take a look!\\nThanks,\\nMadeline'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); // Print the entire match result var_dump($matches);

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php