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

/
/
gi

Test String

Code Generator

Generated Code

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main(String[] args) { final String regex = "\\/\\/(?:[\\w_-]+(?:(?:\\.[\\w_-]+)+))(?:[\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])?"; final String string = "<!DOCTYPE html>\n" + "<html lang=\"en\">\n\n" + "<head>\n" + " <!-- This beautiful and lightning fast landing page was proudly created with Leadpages ( see: https://www.leadpages.net ) and hosted on the Leadpages lead generation platform. -->\n" + " <meta charset=\"utf-8\">\n" + " <meta name=\"leadpages-served-by\" content=\"leadpages\">\n" + " <meta name=\"leadpages-serving-domain\" content=\"https://ixsystems.leadpages.co\">\n" + " <meta name=\"leadpages-stripe-public-key\" content=\"pk_live_R3OLguBtmUzvjaKuwtOa7Kvp\">\n" + " <meta name=\"leadpages-merchant-uuid\" content=\"kRYUiDye8gtbxvvVthNnkW\">\n" + " <meta charset=\"utf-8\">\n" + " <script>\n" + " window.AnalyticsPropertyID = \"rMx3rsBoVfadWMfoLN2z5n\";\n" + " </script>\n" + " <link rel=\"stylesheet\" type=\"text/css\" href=\"https://ixsystems.leadpages.co/static/lp1483572580/public/css/leadpage.css\">\n" + " <script>\n" + " window.LeadPageData = { \"facebookShareURL\": { \"variable\": \"facebookShareURL\", \"dafault\": \"\", \"name\": \"The URL to share on Facebook. Leave blank to share the current page.\" }, \"twitterShareURL\": { \"variable\": \"twitterShareURL\", \"dafault\": \"\", \"name\": \"The URL to share on Twitter. Leave blank to share the current page.\" }, \"googleShareURL\": { \"variable\": \"googleShareURL\", \"dafault\": \"\", \"name\": \"The URL to share on Google+. Leave blank to share the current page.\" }, \"linkedInShareURL\": { \"variable\": \"linkedInShareURL\", \"dafault\": \"\", \"name\": \"The URL to share on LinkedIn. Leave blank to share the current page.\" } };\n" + " </script>\n" + " <script type=\"text/javascript\" src=\"https://ixsystems.leadpages.co/static/lp1483572580/public/js/leadpage.js\"></script>\n" + " <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n" + " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n" + " <style>\n" + " @import url(https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css);\n" + " </style>\n" + " <link href=\"https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600\" rel=\"stylesheet\" type=\"text/css\">\n" + " <link rel=\"stylesheet\" href=\"https://ixsystems.leadpages.co/f//w5N55HkAEv%252BpK6kOFyh0KJ%252BRqC3JrztqsFbxy0Bc0iNSQCQTWrQMlWdvEiLQEXpYt8gPbmjzAk3KS4AbwJdag%253D%253D%7Ccss/normalize.min.css\">\n" + " <link rel=\"stylesheet\" type=\"text/css\" href=\"https://ixsystems.leadpages.co/f//w5N55HkAEv%252BpK6kOFyh0KJ%252BRqC3JrztqsFbxy0Bc0hcHiFxsb3VUc6tIAt5lPy8NykuAG8CXWo%253D%7Ccss/style.css\">\n" + " <script src=\"https://ixsystems.leadpages.co/f//w5N55HkAEv%252BpK6kOFyh0KJ%252BRqC3JrztqsFbxy0Bc0jINLrZD2o7qCJeTqzOuwVVkqSGeDambc2fKvbfDci7Jg%253D%253D%7Cjs/html5shiv.js\"></script>\n" + " <script type=\"text/javascript\" src=\"http://www.omncdn.com/thankyou/CustomPage2/jeremyquinn/9/jquery.js\"></script>\n" + " <script type=\"text/javascript\" src=\"http://www.omncdn.com/thankyou/CustomPage2/jeremyquinn/9/modernizer.js\"></script>\n" + " <script type=\"text/javascript\" src=\"http://www.omncdn.com/thankyou/CustomPage2/jeremyquinn/9/function.js\"></script>\n" + " <link href=\"http://www.omncdn.com/thankyou/CustomPage2/jeremyquinn/9/style.css\" type=\"text/css\" rel=\"stylesheet\">\n" + " <style>\n" + " .popup {\n" + " width: 80%;\n" + " margin: 0 auto\n" + " }\n\n" + " #pop-head .head {\n" + " font-family: \"Open Sans Condensed\";\n" + " font-size: 26px;\n" + " color: #545555;\n" + " font-weight: 700;\n" + " line-height: 30px;\n" + " text-align: center;\n" + " margin: 20px auto 10px auto\n" + " }\n\n" + " .book-small {\n" + " float: left;\n" + " margin: -60px 10px 0 -50px\n" + " }\n\n" + " .popup input#fname,\n" + " .popup input#email {\n" + " width: 100%;\n" + " height: 50px;\n" + " font-size: 16px;\n" + " line-height: 26px;\n" + " color: #989898;\n" + " padding: 0;\n" + " margin: 5px auto;\n" + " border: 1px solid #cacaca;\n" + " text-align: center;\n" + " -webkit-box-shadow: inset 1px 0px 10px 1px rgba(170, 170, 170, 0.3);\n" + " box-shadow: inset 1px 0px 10px 1px rgba(170, 170, 170, 0.3)\n" + " }\n\n" + " #pop-footer {\n" + " background-color: #d9d9d9;\n" + " min-height: 57px;\n" + " margin-top: 20px;\n" + " padding-top: 10px;\n" + " border-radius: 0 0 5px 5px;\n" + " -webkit-border-radius: 0 0 5px 5px;\n" + " -webkit-box-shadow: inset 0px 1px 5px 0px rgba(0, 0, 0, 0.2);\n" + " box-shadow: inset 0px 1px 5px 0px rgba(0, 0, 0, 0.2)\n" + " }\n\n" + " #pop-footer p {\n" + " font-size: 14px;\n" + " color: #767677;\n" + " text-align: center;\n" + " margin-bottom: 0\n" + " }\n\n" + " .popup .btn {\n" + " font-family: 'Open Sans Condensed';\n" + " text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);\n" + " filter: dropshadow(color=rgba(0, 0, 0, 0.3), offx=1, offy=1);\n" + " background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #fed800), color-stop(1, #f5c800));\n" + " background: -moz-linear-gradient(center top, #fed800 5%, #f5c800 100%);\n" + " filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fed800', endColorstr='#f5c800');\n" + " background-color: #fed800;\n" + " display: block;\n" + " margin: 8px auto 0 auto;\n" + " position: relative;\n" + " min-height: 58px;\n" + " width: 100%;\n" + " font-weight: 700;\n" + " font-size: 30px;\n" + " color: #fdfdfd;\n" + " border-radius: 3px;\n" + " -webkit-border-radius: 3px;\n" + " -moz-border-radius: 3px;\n" + " border: none;\n" + " padding: 10px 20px 15px;\n" + " font-size: 30px;\n" + " text-align: center\n" + " }\n\n" + " .popup .btn:hover {\n" + " background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f5c800), color-stop(1, #fed800));\n" + " background: -moz-linear-gradient(center top, #f5c800 5%, #fed800 100%);\n" + " filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5c800', endColorstr='#fed800');\n" + " background-color: #f5c800\n" + " }\n\n" + " .popup .btn:active {\n" + " position: relative;\n" + " top: 1px\n" + " }\n\n" + " .popup .btn:after {\n" + " content: '\\00BB'\n" + " }\n\n" + " .pop-up-footer-text {\n" + " font-family: 'Open Sans';\n" + " color: #505050;\n" + " font-size: 14px;\n" + " text-align: center;\n" + " margin: 5px auto;\n" + " padding: 0\n" + " }\n\n" + " .reveal-modal-bg {\n" + " position: fixed;\n" + " height: 100%;\n" + " width: 100%;\n" + " background: #000;\n" + " background: rgba(0, 0, 0, .8);\n" + " z-index: 100;\n" + " display: none;\n" + " top: 0;\n" + " left: 0\n" + " }\n\n" + " .reveal-modal {\n" + " visibility: hidden;\n" + " top: 100px;\n" + " left: 45%;\n" + " margin-left: -300px;\n" + " width: 714px;\n" + " min-height: 200px;\n" + " background: #fff no-repeat -200px -80px;\n" + " position: absolute;\n" + " z-index: 101;\n" + " -moz-border-radius: 10px;\n" + " -moz-box-shadow: 0 0 10px rgba(0, 0, 0, .4);\n" + " -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, .4);\n" + " -box-shadow: 0 0 10px rgba(0, 0, 0, .4);\n" + " border-radius: 5px;\n" + " -webkit-border-radius: 5px\n" + " }\n\n" + " .reveal-modal.small {\n" + " width: 200px;\n" + " margin-left: -140px\n" + " }\n\n" + " .reveal-modal.medium {\n" + " width: 400px;\n" + " margin-left: -240px\n" + " }\n\n" + " .reveal-modal.large {\n" + " width: 600px;\n" + " margin-left: -340px\n" + " }\n\n" + " .reveal-modal.xlarge {\n" + " width: 800px;\n" + " margin-left: -440px\n" + " }\n\n" + " .reveal-modal .close-reveal-modal {\n" + " font-size: 22px;\n" + " line-height: .5;\n" + " position: absolute;\n" + " top: -30px;\n" + " right: -40px;\n" + " color: #aaa;\n" + " text-shadow: 0 -1px 1px rbga(0, 0, 0, .6);\n" + " font-weight: bold;\n" + " cursor: pointer\n" + " }\n\n" + " @media only screen and (max-width:800px) {\n" + " .reveal-modal {\n" + " visibility: hidden;\n" + " top: 200px;\n" + " left: 45%;\n" + " margin-left: -35%;\n" + " width: 80%\n" + " }\n" + " }\n" + " </style>\n" + " <title>Introducing the TrueNAS X10</title>\n" + " <meta content=\"\" name=\"description\">\n" + " <meta content=\"\" name=\"keywords\">\n" + " <meta content=\"146039073f72a2:12451c44c346dc\" name=\"leadpages-meta-id\">\n" + " <meta content=\"//ixsystems.leadpages.co\" name=\"leadpages-url\">\n" + " <script>\n" + " (function(a, c, d, b, e, f) { a[d] = b;\n" + " a[b] || (a[b] = function() { a[b].q = a[b].q || [];\n" + " a[b].q.push(arguments) }, d = c.createElement(e), d.async = !0, d.src = f, c = c.getElementsByTagName(e)[0], c.parentNode.insertBefore(d, c)) })(window, document, \"LeadPagesCenterObject\", \"center\", \"script\", \"https://js.center.io/center.js\");\n" + " center('create', 'rMx3rsBoVfadWMfoLN2z5n', 'rMx3rsBoVfadWMfoLN2z5n', { customId: 'lp-5735267667279872' });\n" + " </script>\n" + " <script>\n" + " center('send', 'view', 'leadpage', 5735267667279872)\n" + " </script>\n" + "</head>\n\n" + "<body>\n" + " <header class=\"header role-element leadstyle-container\" style=\"background-image: url(&quot;//lh3.googleusercontent.com/nb_3u8pM7svZwqnWiF6zjIeHFljlncHDhq5RQwlArNfYZ31h7l4mkPSO2TjZYQZvY4Vm8MbaaRdKfBHIc9FWA2c=s0&quot;); background-size: cover; background-position: center top;\">\n" + " <img src=\"//lh3.googleusercontent.com/nb_3u8pM7svZwqnWiF6zjIeHFljlncHDhq5RQwlArNfYZ31h7l4mkPSO2TjZYQZvY4Vm8MbaaRdKfBHIc9FWA2c=s0\" id=\"header-bg-image\" class=\"header-bg-img role-element leadstyle-image\">\n" + " <div class=\"header_title\">\n" + " <h1 class=\"role-element leadstyle-text\"><span class=\"leadstyle-fontsized\" style=\"font-size:28px;\"><span id=\"m_1466959868681406623docs-internal-guid-1fff18b8-053a-8855-d348-258d0028ed51\"><span id=\"m_1466959868681406623docs-internal-guid-15e508f5-053b-7e30-4487-191db66e2da4\"><span id=\"m_1466959868681406623docs-internal-guid-15e508f5-053c-749d-0558-76544dd004e0\"><span style=\"font-family: Roboto; font-weight: 700; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; vertical-align: baseline; white-space: pre-wrap;\">Introducing the TrueNAS X10</span></span></span></span></span></h1>\n" + " <h2 class=\"role-element leadstyle-text\"><span style=\"font-family:open sans;\"><span class=\"leadstyle-fontsized\" style=\"font-size:26px;\">DURING THIS FREE WEBINAR YOU WILL LEARN:</span><br><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\">&#8226;</span></span><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\"> What is the M&amp;E industry?</span><br><span style=\"font-family:open sans;\"><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\">&#8226; </span></span><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\">How TrueNAS benefits the M&amp;E customer</span><br><span style=\"font-family:open sans;\"><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\">&#8226; </span></span><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\">Common M&amp;E operations</span><br><span style=\"font-family:open sans;\"><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\">&#8226; </span></span><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\">Storage issues encountered during M&amp;E operations</span><br><span style=\"font-family:open sans;\"><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\">&#8226; </span></span><span class=\"leadstyle-fontsized\" style=\"font-size:20px;\">How TrueNAS resolves these issues </span></h2>\n" + " </div>\n" + " </header>\n" + " <div class=\"main role-element leadstyle-container\">\n" + " <div class=\"main_left role-element leadstyle-container\">\n" + " <div class=\"media\">\n" + " <img src=\"//lh3.googleusercontent.com/PmXCCYDakVLqrLUEEpeQkY9boPvCAiEBYjVkHgXhQa4TOYQhL3oimNgX5ixI1VYF8Nv1oT6aseawRU32Y2PYrA=s0\" class=\"media__img floatL role-element leadstyle-image\" style=\"max-width: 176px;\">\n" + " <div class=\"media__body role-element leadstyle-container\">\n" + " <h3 class=\"role-element leadstyle-text\">Co-Hosted by TIM NAGLE</h3>\n" + " <p class=\"main_left-title role-element leadstyle-text\"><strong>With Brad Meyer</strong></p>\n" + " <p class=\"role-element leadstyle-text\"><span id=\"m_1466959868681406623docs-internal-guid-1fff18b8-053a-8855-d348-258d0028ed51\"><span style=\"font-size:18.666666666666664px;font-family:Roboto;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap\"><span id=\"m_1466959868681406623docs-internal-guid-1fff18b8-053a-ee32-74a9-3267b8dd3670\"><span id=\"m_1466959868681406623docs-internal-guid-15e508f5-053d-1f60-4350-6c91e6fb98d8\"><span style=\"font-size:16px;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;vertical-align:baseline\">Tim Nagle is the founder of Creative Integrations, a full-service M&amp;E organization that specializes in providing post-production, recording, animation, and broadcast facilities to hundreds of clients worldwide. Brad Meyer is the lead technical marketing engineer for TrueNAS at iXsystems.</span></span>\n" + " </span>\n" + " </span>\n" + " </span> <span id=\"m_1466959868681406623docs-internal-guid-1fff18b8-053a-8855-d348-258d0028ed51\"><span style=\"font-size:18.666666666666664px;font-family:Roboto;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap\"><span id=\"m_1466959868681406623docs-internal-guid-1fff18b8-053a-ee32-74a9-3267b8dd3670\"><span id=\"m_1466959868681406623docs-internal-guid-15e508f5-053d-1f60-4350-6c91e6fb98d8\"><img class=\"ajT\" src=\"https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif\"></span></span>\n" + " </span>\n" + " </span>\n" + " </p>\n" + " </div>\n" + " </div>\n" + " </div>\n" + " <div class=\"main_right border-left role-element leadstyle-container\">\n" + " <h3 class=\"role-element leadstyle-text\">Register free now!</h3>\n" + " <p class=\"main_right-title role-element leadstyle-text\">It&#8217;s happening this [[WEEKDAY+next0]] ([[MMMM+next0]] [[DO+next0]]) at...</p>\n" + " <div class=\"main_right-calendar role-element leadstyle-container\">\n" + " <p class=\"month role-element leadstyle-text\">[[WEEKDAY+next0]]</p>\n" + " <p class=\"day role-element leadstyle-text\">[[DD+next0]]</p>\n" + " </div>\n" + " <div class=\"main_right-dates\">\n" + " <ul class=\"main_right-list role-element leadstyle-text\">\n" + " <li>[[time1+next0]] Pacific</li>\n" + " <li>[[time1+next0+1HOUR]] Mountain</li>\n" + " <li>[[time1+next0+2HOUR]] Central</li>\n" + " <li>[[time1+next0+3HOUR]] Eastern</li>\n" + " </ul>\n" + " </div>\n" + " </div>\n" + " </div>\n" + " <div class=\"section01\">\n" + " <div class=\"container role-element leadstyle-container\">\n" + " <div class=\"countdown-wrap role-element leadstyle-container\">\n" + " <h3 class=\"count-headline role-element leadstyle-text\">THIS WEBINAR WILL START IN</h3>\n" + " <ul class=\"countdown role-element leadstyle-countdown\" data-timestamp=\"[[timestamp+next0]]000\">\n" + " <li>\n" + " <div class=\"flap\">\n" + " <span id=\"days\" class=\"days\">0</span>\n" + " </div>\n" + " <p class=\"timeRefDays role-element leadstyle-text\">DAYS</p>\n" + " </li>\n" + " <li>\n" + " <div class=\"flap\">\n" + " <span id=\"hours\" class=\"hours\">0</span>\n" + " </div>\n" + " <p class=\"timeRefHours role-element leadstyle-text\">HOURS</p>\n" + " </li>\n" + " <li>\n" + " <div class=\"flap\">\n" + " <span id=\"minutes\" class=\"minutes\">0</span>\n" + " </div>\n" + " <p class=\"timeRefMinutes role-element leadstyle-text\">MINUTES</p>\n" + " </li>\n" + " <li>\n" + " <div class=\"flap\">\n" + " <span id=\"seconds\" class=\"seconds\">0</span>\n" + " </div>\n" + " <p class=\"timeRefSeconds role-element leadstyle-text\">SECONDS</p>\n" + " </li>\n" + " </ul>\n" + " </div>\n" + " <a href=\"#\" data-reveal-id=\"myModal\" class=\"btn cta01 role-element leadstyle-link\">YES! Sign ME UP &#187;</a>\n" + " </div>\n" + " </div>\n" + " <div class=\"section03\">\n" + " </div>\n" + " <footer class=\"footer\">\n" + " <p class=\"footer_legal role-element leadstyle-text\"><a target=\"_blank\" href=\"https://www.ixsystems.com/privacy-policy/\">Privacy Policy</a></p>\n" + " </footer>\n" + " <link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.omncdn.com/thankyou/downloads/form.css\" />\n" + " <div id=\"myModal\" class=\"popup-container reveal-modal\">\n" + " <script type=\"text/javascript\" src=\"http://www.omncdn.com/thankyou/CustomPage/Geoff/mobile.js\"></script>\n" + " <div id=\"leadpages-form-wrapper\">\n" + " <form action=\"http://www.onlinemeetingnow.com/seminar/?id=[[id]]\" method=\"POST\" class=\"form-horizontal no-image\" id=\"leadpages-form\" style=\"background-color: rgb(255, 255, 255); border-style: solid; border-width: 1pt; border-color: rgb(255, 255, 255)\" accept-charset=\"utf-8\">\n" + " <a class=\"close-reveal-modal\">\n" + "<img src=\"//lh4.ggpht.com/eTzgQFXzaxNZzAsEGJyKl1WLVocESwwJFPPpfaoi3osmL1VKiZLMsq8jMnvIVhcHrnZYr4sJSK7CYhbOp5ce3Q=s0\">\n" + "</a>\n" + " <div id=\"leadpages-form-header\">\n" + " <img id=\"leadpages-form-header-image\" src=\"https://ixsystems.leadpages.co/static/lp1481749521/img/leadbox_status_bar_gray3.gif\" />\n" + " <div id=\"leadpages-form-header-text\" style=\"font-family: Helvetica,Arial,sans-serif; font-size: 10pt; letter-spacing: 0em; display: block\">\n" + " Almost there! Please answer a few quick questions to save your spot.\n" + " </div>\n" + " </div>\n" + " <div class=\"leadbox-content-wrapper\">\n" + " <div id=\"leadpages-form-title\" style=\"font-family: &#34;Open Sans&#34;,Helvetica,Arial,sans-serif; font-size: 18pt; letter-spacing: 0em; display: block\">\n" + " <div style=\"text-align: center\">\n" + " <strong>Enter your email address and click the button\n" + " below to save your seat.</strong>\n" + " </div>\n" + " </div>\n" + " <div id=\"leadpages-fieldset-wrapper\">\n" + " <fieldset id=\"leadpages-fieldset\">\n" + " <input name=\"inf_form_xid\" type=\"hidden\" value=\"4c75d0385a3b52fa2ef843bee2d7206d\" />\n" + " <input name=\"inf_form_name\" type=\"hidden\" value=\"Registrants\" />\n" + " <input name=\"infusionsoft_version\" type=\"hidden\" value=\"1.60.0.55\" />\n" + " <p style=\"text-align:center;font-family:'Open Sans',Helvetica,Arial,sans-serif;font-weight:normal;font-size:13px;\">\n" + " <input name=\"date_option\" type=\"radio\" value=\"option1|[[timestamp+next0]]\" checked>&#160;[[datetime+next0]] ([[timezone]])\n" + " <br>\n" + " </p>\n" + " <div class=\"control-group\" id=\"leadpages-container-inf-field-FirstName\">\n" + " <div class=\"controls\">\n" + " <input type=\"text\" name=\"inf_field_FirstName\" value=\"\" id=\"inf-field-FirstName\" placeholder=\"First Name\" data-source=\"leadpages-first_name\" data-role=\"first_name\" required=\"required\" />\n" + " </div>\n" + " <span class=\"error-container\" id=\"leadpages-error-inf-field-FirstName\"></span>\n" + " </div>\n" + " <div class=\"control-group\" id=\"leadpages-container-inf-field-Email\">\n" + " <div class=\"controls\">\n" + " <input type=\"email\" name=\"inf_field_Email\" value=\"\" id=\"inf-field-Email\" placeholder=\"Email\" data-source=\"leadpages-email\" data-role=\"email\" required=\"required\" />\n" + " </div>\n" + " <span class=\"error-container\" id=\"leadpages-error-inf-field-Email\"></span>\n" + " </div>\n" + " <div class=\"control-group\">\n" + " <div class=\"controls\">\n" + " <button id=\"leadpages-submit-button\" type=\"submit\" style=\"font-family: &#34;Open Sans&#34;,Helvetica,Arial,sans-serif; font-size: 14pt; letter-spacing: 0em; background-color: rgb(18, 133, 221); border-style: solid; border-width: 0pt; border-top-width: 0pt; border-right-width: 0pt; border-bottom-width: 0pt; border-left-width: 0pt; border-color: rgb(227, 227, 227); text-shadow: 2px 2px 0px rgb(18, 133, 221)\">\n" + " <div style=\"text-align: center\">Register Now <span class=\"raquo\">&#187;</span></div>\n" + " </button>\n" + " </div>\n" + " </div>\n" + " <div class=\"leadpages-spacer\">- -</div>\n" + " </fieldset>\n" + " </div>\n" + " <div id=\"leadpages-privacy-policy\" style=\"font-family: &#34;Open Sans&#34;,Helvetica,Arial,sans-serif; font-size: 10pt; letter-spacing: \">\n" + " <div style=\"text-align: center\">\n" + " <i class=\"icon-lock\"></i> We hate SPAM and promise to keep your email address safe.\n" + " </div>\n" + " </div>\n" + " </div>\n" + " <div class=\"leadpages-spacer\">- -</div>\n" + " <input name=\"inf_custom_SSWebinarDateTimeText\" type=\"hidden\" value=\"[[datetime]] ([[timezone]])\" />\n" + " <input name=\"inf_custom_SSWebinarTitle\" type=\"hidden\" value=\"[[title]]\" />\n" + " <input name=\"inf_custom_SSWebinarUrl\" type=\"hidden\" value=\"[[id]]\" />\n" + " </form>\n" + " </div>\n" + " <script type=\"text/javascript\" src=\"//my.leadpages.net/static/lp786/min/css_browser_selector.js\"></script>\n" + " </div>\n" + " <script src=\"http://omncdn.com/thankyou/html5/forhtml5.js\"></script>\n" + " <script src=\"//my.leadpages.net/static/lp1483572580/min/tracking.js\"></script>\n" + " <!-- Snippet used on StealthSeminar.com to integrate their form with our Marketo -->\n" + " <script src=\"//app-sj20.marketo.com/js/forms2/js/forms2.min.js\"></script>\n" + " <form id=\"mktoForm_1171\" style=\"display:none\"></form>\n" + " <script>\n" + " var marketyform;\n" + " MktoForms2.loadForm(\"//app-sj20.marketo.com\", \"855-MUM-343\", 1171, function(form) {\n" + " marketyform = form;\n" + " marketyform.onSuccess(function() {\n" + " jQuery(\"#leadpages-submit-button\").data(\"finish\", \"true\").click();\n" + " return false;\n" + " });\n" + " });\n\n" + " jQuery.urlParam = function(name) {\n" + " var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);\n" + " if (results == null) {\n" + " return null;\n" + " } else {\n" + " return results[1] || 0;\n" + " }\n" + " }\n\n" + " jQuery(document).ready(function() {\n\n" + " jQuery(\"#leadpages-submit-button\").click(function(e) {\n" + " if (jQuery(this).data(\"finish\") !== \"true\") {\n" + " e.stopPropagation();\n" + " e.preventDefault();\n\n" + " var fn = jQuery(\"#inf-field-FirstName\").val();\n" + " var em = jQuery(\"#inf-field-Email\").val();\n" + " var ph = jQuery(\"#inf-field-Phone1\").val();\n" + " var st = jQuery(\"#inf-field-State\").val();\n" + " var fik = new Date(jQuery('input[name=date_option]:checked').val().split(\"|\")[1] * 1000);\n\n" + " try {\n" + " fik = fik.toISOString();\n" + " } catch (err) {\n" + " fik = \"2001-01-01T00:00:00.000Z\";\n" + " }\n\n" + " marketyform.addHiddenFields({\n" + " \"Email\": em,\n" + " \"FirstName\": fn,\n" + " \"Phone\": ph,\n" + " \"State\": st,\n" + " \"webinarTime\": fik,\n" + " \"webinarDate\": fik.substring(0, 10),\n" + " \"SSWebinarID\": jQuery.urlParam(\"id\")\n" + " });\n" + " marketyform.submit();\n" + " }\n" + " });\n" + " });\n" + " </script>\n" + " <script type=\"text/javascript\">\n" + " (function() {\n" + " var didInit = false;\n\n" + " function initMunchkin() {\n" + " if (didInit === false) {\n" + " didInit = true;\n" + " Munchkin.init('855-MUM-343');\n" + " }\n" + " }\n" + " var s = document.createElement('script');\n" + " s.type = 'text/javascript';\n" + " s.async = true;\n" + " s.src = '//munchkin.marketo.net/munchkin.js';\n" + " s.onreadystatechange = function() {\n" + " if (this.readyState == 'complete' || this.readyState == 'loaded') {\n" + " initMunchkin();\n" + " }\n" + " };\n" + " s.onload = initMunchkin;\n" + " document.getElementsByTagName('head')[0].appendChild(s);\n" + " })();\n" + " </script>\n" + "</body>\n" + "<!-- This beautiful and lightning fast landing page was proudly created with Leadpages ( see: https://www.leadpages.net ) and hosted on the Leadpages lead generation platform. -->\n\n" + "</html>"; final Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); final Matcher matcher = pattern.matcher(string); while (matcher.find()) { System.out.println("Full match: " + matcher.group(0)); for (int i = 1; i <= matcher.groupCount(); i++) { System.out.println("Group " + i + ": " + matcher.group(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 Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html