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"
"
gm

Test String

Code Generator

Generated Code

$re = '/ <a href=.+?(.+?)\".+?\n.+?\n.+?\n\n.+?\n.+?>(.+?)</m'; $str = ' <!DOCTYPE html> <html class="bg-gray-100" lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- CSRF Token --> <meta name="csrf-token" content="aQARA7cSfHFdGaBrobisAgEAtH5mn49dUQd9W9Sm"> <meta name="robots" content="index, follow"> <title>NBA Streams | NBA Live Stream | Watch NBA Reddit Streams free - Givemereddit.stream</title> <meta name="description" content="Watch NBA Streams Online free | NBA Live Streaming Basketball Game | Watch NBA Reddit Streams free"> <link rel="canonical" href="http://givemereddit.stream/nba"/> <meta property="og:title" content="NBA Streams | NBA Live Stream | Watch NBA Reddit Streams free - Givemereddit.stream" /> <meta property="og:description" content="Watch NBA Streams Online free | NBA Live Streaming Basketball Game | Watch NBA Reddit Streams free" /> <meta property="og:url" content="http://givemereddit.stream/nba" /> <meta property="og:image:url" content="http://givemereddit.stream/images/nba.png" /> <meta name="twitter:title" content="NBA Streams | NBA Live Stream | Watch NBA Reddit Streams free - Givemereddit.stream" /> <meta name="twitter:description" content="Watch NBA Streams Online free | NBA Live Streaming Basketball Game | Watch NBA Reddit Streams free" /> <script type="application/ld+json">{"@context":"https:\\/\\/schema.org","@type":"WebPage","name":"NBA Streams | NBA Live Stream | Watch NBA Reddit Streams free - Givemereddit.stream","description":"Watch NBA Streams Online free | NBA Live Streaming Basketball Game | Watch NBA Reddit Streams free"}</script> <!-- Fonts --> <link rel="dns-prefetch" href="//fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <!-- Styles --> <link href="http://givemereddit.stream/css/app.css" rel="stylesheet"> <!-- PopAds.net Popunder Code for givemereddit.stream | 2019-08-25,3443629,0,0 --> <script type="text/javascript" data-cfasync="false"> /*<![CDATA[/* */ /* Privet darkv. Each domain is 2h fox dead */ (function(){ var a=window;a["_\\x70\\u006fp"]=[["\\u0073i\\u0074\\x65\\x49\\u0064",3443629],["\\x6d\\u0069\\u006e\\u0042\\u0069\\u0064",0],["po\\u0070\\x75\\x6ede\\u0072\\x73Pe\\x72I\\x50",0],["dela\\x79\\u0042e\\u0074\\u0077e\\u0065\\u006e",0],["\\u0064\\x65\\x66\\x61ul\\u0074",false],["\\x64\\x65\\x66\\u0061u\\u006c\\x74\\u0050\\x65\\u0072D\\u0061\\u0079",0],["\\x74o\\u0070m\\x6f\\x73tL\\u0061\\x79\\x65r",!0]];var b=["\\u002f\\x2f\\x631\\u002ep\\x6f\\x70\\x61\\u0064s\\x2e\\u006e\\x65\\x74\\u002f\\x70\\x6f\\u0070.\\u006a\\u0073","\\x2f/\\x63\\x32\\u002e\\u0070\\u006fp\\u0061d\\x73\\u002en\\u0065\\u0074\\u002fpo\\x70\\u002e\\x6a\\x73","\\x2f\\u002f\\x77\\x77\\u0077\\x2ezw\\u006d\\u0061u\\u0079\\x65\\u0072f\\x6f\\x74\\u0079h\\u002e\\u0063\\x6fm\\u002f\\x7a\\u0066zz.\\u006a\\u0073","/\\u002fw\\u0077\\x77\\u002e\\u0065y\\u0076\\x63\\u006a\\x74\\u006f\\x69\\u0077\\u0062rt\\x2e\\u0063\\x6f\\x6d\\x2fs\\x6b\\x2e\\x6as",""],i=0,q,z=function(){if(""==b[i])return;q=a["do\\x63u\\u006d\\x65nt"]["\\u0063\\u0072\\x65a\\x74\\u0065\\u0045\\u006c\\u0065\\x6d\\u0065\\x6et"]("\\u0073\\x63\\x72i\\u0070\\u0074");q["\\x74\\x79\\u0070\\u0065"]="\\u0074\\u0065\\x78\\u0074/\\u006a\\u0061vascri\\u0070\\x74";q["a\\x73y\\x6e\\u0063"]=!0;var t=a["\\x64o\\u0063u\\x6d\\u0065\\u006e\\u0074"]["\\u0067\\x65tEl\\x65\\u006de\\u006e\\x74s\\x42\\x79\\u0054\\u0061\\x67\\u004e\\x61\\x6d\\u0065"]("\\x73\\u0063\\x72\\x69pt")[0];q["\\x73rc"]=b[i];if(i<2){q["\\x63\\x72o\\u0073\\x73\\u004f\\u0072\\x69\\u0067\\u0069n"]="a\\x6e\\u006f\\u006eym\\x6f\\x75\\x73";};q["\\u006f\\u006eer\\u0072or"]=function(){i++;z()};t["\\u0070a\\u0072ent\\x4e\\x6f\\x64\\u0065"]["i\\u006e\\x73\\x65\\u0072tB\\u0065\\x66o\\x72e"](q,t)};z()})(); /*]]>/* */ </script> <script type=\'text/javascript\' src=\'//6ped2nd3yp.com/e1/7c/b4/e17cb4569586349259faa5d52f760831.js\'></script> <!-- Histats.com START (aync)--> <script type="text/javascript">var _Hasync= _Hasync|| []; _Hasync.push([\'Histats.start\', \'1,4219053,4,0,0,0,00010000\']); _Hasync.push([\'Histats.fasi\', \'1\']); _Hasync.push([\'Histats.track_hits\', \'\']); (function() { var hs = document.createElement(\'script\'); hs.type = \'text/javascript\'; hs.async = true; hs.src = (\'//s10.histats.com/js15_as.js\'); (document.getElementsByTagName(\'head\')[0] || document.getElementsByTagName(\'body\')[0]).appendChild(hs); })();</script> <noscript><a href="/" target="_blank"><img src="//sstatic1.histats.com/0.gif?4219053&101" alt="hit counter code" border="0"></a></noscript> <!-- Histats.com END --> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-134092350-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(\'js\', new Date()); gtag(\'config\', \'UA-134092350-1\'); </script> <!-- Go to www.addthis.com/dashboard to customize your tools --> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4e4ef3a74f5939f1"></script> </head> <body> <div id="app"> <nav class="flex items-center justify-between flex-wrap bg-primary p-5 shadow-lg"> <div class="flex items-center flex-shrink-0 text-white mr-6"> <a href="http://givemereddit.stream" class="font-semibold text-xl text-white tracking-tight">Givemereddit.stream</span> </div> <div class="block lg:hidden"> <a href="javascript:;" class="menu-toggle flex items-center px-3 py-2 border rounded text-teal-200 border-teal-400 hover:text-white hover:border-white"> <svg class="fill-current h-3 w-3" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <title>Menu</title> <path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z" /> </svg> </a> </div> <div class="navbar w-full block flex-grow lg:flex lg:items-center lg:w-auto hidden lg:block"> <div class="text-sm lg:flex-grow"> <a href="/nfl" class="block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-white mr-4"> NFL STREAM </a> <a href="/nba" class="block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-white mr-4"> NBA STREAM </a> <a href="/nhl" class="block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-white mr-4"> NHL STREAM </a> <a href="/soccer" class="block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-white mr-4"> SOCCER STREAM </a> <a href="/ufc-mma" class="block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-white mr-4"> UFC STREAM </a> </div> </div> </nav> <meta name="hilltopads-site-verification" content="02106e2980f578f514f055a540231cb1c213a151" /> <main class="p-5 bg-gray-200"> <div class="w-full"> <div class="flex flex-col lg:flex-row"> <div class="w-full lg:w-8/12 lg:pr-5"> <h1 class="text-2xl text-primary">NBA Live Streams Schedule</h1> <hr class="mb-4 mt-2"> <a href="http://givemereddit.stream/nba/nba-network-live-stream" class="block w-full rounded overflow-hidden shadow-md hover:shadow-lg mb-6 bg-white"> <div class="px-4 py-5 flex flex-row items-center"> <img class="w-12 md:w-16" src="http://givemereddit.stream/images/nba.png"> <div class="pl-4 w-full text-center"> <h3 class="text-sm sm:text-xl mb-2">NBA TV Live Stream</h3> <p class="text-gray-700 text-xs sm:text-sm"> October 11, 2019 - 2:08 AM </p> </div> </div> </a> <a href="http://givemereddit.stream/nba/pistons-live-stream" class="block w-full rounded overflow-hidden shadow-md hover:shadow-lg mb-6 bg-white"> <div class="px-4 py-5 flex flex-row items-center"> <img class="w-12 md:w-16" src="http://givemereddit.stream/images/nba.png"> <div class="pl-4 w-full text-center"> <h3 class="text-sm sm:text-xl mb-2">Detroit Pistons vs Cleveland Cavaliers</h3> <p class="text-gray-700 text-xs sm:text-sm"> October 11, 2019 - 10:18 PM </p> </div> </div> </a> <a href="http://givemereddit.stream/nba/knicks-live-stream" class="block w-full rounded overflow-hidden shadow-md hover:shadow-lg mb-6 bg-white"> <div class="px-4 py-5 flex flex-row items-center"> <img class="w-12 md:w-16" src="http://givemereddit.stream/images/nba.png"> <div class="pl-4 w-full text-center"> <h3 class="text-sm sm:text-xl mb-2">New York Knicks vs Washington Wizards</h3> <p class="text-gray-700 text-xs sm:text-sm"> October 11, 2019 - 6:53 PM </p> </div> </div> </a> <a href="http://givemereddit.stream/nba/bulls-live-stream" class="block w-full rounded overflow-hidden shadow-md hover:shadow-lg mb-6 bg-white"> <div class="px-4 py-5 flex flex-row items-center"> <img class="w-12 md:w-16" src="http://givemereddit.stream/images/nba.png"> <div class="pl-4 w-full text-center"> <h3 class="text-sm sm:text-xl mb-2">Indiana Pacers vs Chicago Bulls</h3> <p class="text-gray-700 text-xs sm:text-sm"> October 11, 2019 - 6:56 PM </p> </div> </div> </a> <a href="http://givemereddit.stream/nba/pelicans-live-stream" class="block w-full rounded overflow-hidden shadow-md hover:shadow-lg mb-6 bg-white"> <div class="px-4 py-5 flex flex-row items-center"> <img class="w-12 md:w-16" src="http://givemereddit.stream/images/nba.png"> <div class="pl-4 w-full text-center"> <h3 class="text-sm sm:text-xl mb-2">New Orleans Pelicans vs Utah Jazz</h3> <p class="text-gray-700 text-xs sm:text-sm"> October 11, 2019 - 5:15 PM </p> </div> </div> </a> <a href="http://givemereddit.stream/nba/bucks-live-stream" class="block w-full rounded overflow-hidden shadow-md hover:shadow-lg mb-6 bg-white"> <div class="px-4 py-5 flex flex-row items-center"> <img class="w-12 md:w-16" src="http://givemereddit.stream/images/nba.png"> <div class="pl-4 w-full text-center"> <h3 class="text-sm sm:text-xl mb-2">Milwaukee Bucks vs Dallas Mavericks</h3> <p class="text-gray-700 text-xs sm:text-sm"> October 11, 2019 - 10:23 PM </p> </div> </div> </a> <a href="http://givemereddit.stream/nba/76ers-live-stream" class="block w-full rounded overflow-hidden shadow-md hover:shadow-lg mb-6 bg-white"> <div class="px-4 py-5 flex flex-row items-center"> <img class="w-12 md:w-16" src="http://givemereddit.stream/images/nba.png"> <div class="pl-4 w-full text-center"> <h3 class="text-sm sm:text-xl mb-2">Charlotte Hornets vs Philadelphia 76ers</h3> <p class="text-gray-700 text-xs sm:text-sm"> October 11, 2019 - 5:14 PM </p> </div> </div> </a> <a href="http://givemereddit.stream/nba/celtics-live-stream" class="block w-full rounded overflow-hidden shadow-md hover:shadow-lg mb-6 bg-white"> <div class="px-4 py-5 flex flex-row items-center"> <img class="w-12 md:w-16" src="http://givemereddit.stream/images/nba.png"> <div class="pl-4 w-full text-center"> <h3 class="text-sm sm:text-xl mb-2">Orlando Magic vs Boston Celtics</h3> <p class="text-gray-700 text-xs sm:text-sm"> October 11, 2019 - 4:58 PM </p> </div> </div> </a> </div> <div class="w-full lg:w-4/12"> <div class="w-full rounded shadow-md mb-6 bg-white p-4"> <p></p><h2><font color="red" style="">Welcome to Givemereddit.stream</font></h2> Givmeredditstream brings you a full line-up of the very best quality sports streams. We spend our time collecting streams for you, and we are always checking to make sure there are no problems. We guarantee you great coverage, great quality and reliability on most every device. Free. Nothing to pay, nothing to install. <a href="https://discordapp.com/invite/sVnRYZK" target="_blank"><img src="http://crewofthieves.net/wp-content/uploads/2018/04/CoT-Discord-Banner-1024x157.png" style="width: 100%;"></a> We love sports here at Givemeredditstream and we want to share that with you. We know you can’t always get to the game, or it’s blacked-out in your area, or you need to pay expensive subscription fees. <p></p><p>We are here to help. We offer you the best selection of HD sports streams. Every game in every sport you want is covered, every time. Forget blackouts, forget subscriptions, and just enjoy the game.</p><p><br></p><p> </p><h2> <font color="red" style="">What Games I Can Watch Here?</font> </h2><p>You can watch a range of sports including <a href="http://givemereddit.stream/ufc-mma">UFC streams</a> Reddit. </p><p> It’s the same for <a href="http://givemereddit.stream/nhl">NHL streams</a> as you can see all regular season games, Playoffs and the Stanley Cup Finals. We also cover everything in the <a href="http://givemereddit.stream/nba">NBA streams</a> and the <a href="http://givemereddit.stream/nfl">NFL streams</a> reddit, All games, all Playoffs, Finals and Bowls. And don’t miss HD <a href="http://givemereddit.stream/nba/nba-network-live-stream">NBA stream TV</a> and <a href="http://givemereddit.stream/nfl/nfl-network-live">NFL Network</a> or RedZone. </p> <p>If you like a good fight then we have <a href="http://givemereddit.stream/boxing">Boxing Streams</a> as well. From WWE to UFC, there’s WWE Network and MMA TV and, of course, all the PPV events.</p><p><br></p><h2> <p><font color="red" style="">Our Partners</font> </p></h2><p></p><p><a href="https://nflbite.com/">NFL Live Stream</a> | <a href="https://soccerstreams.net/reddit-soccer-streams/">Soccer Streams</a>&nbsp;</p> <a href="https://footybite.com/"><img src="https://i.imgur.com/ZjMSyZm.png" alt="" width="100" height="20"></a><a href="https://nflbite.com/"><img src="http://scienceandtechnology.xyz/wp-content/uploads/2019/09/Screen-Shot-2019-09-08-at-11.22.27-PM.png" alt="" width="100" height="20"></a> </div> </div> </div> </div> </main> </div> <script src="http://givemereddit.stream/js/app.js" defer></script> <!-- Go to www.addthis.com/dashboard to customize your tools --> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4e4ef3a74f5939f1"></script> </body> </html> '; 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