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

// include the latest version of the regex crate in your Cargo.toml extern crate regex; use regex::Regex; fn main() { let regex = Regex::new(r"(?i)\/\/(?:[\w_-]+(?:(?:\.[\w_-]+)+))(?:[\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?").unwrap(); let string = "<!DOCTYPE html> <html lang=\"en\"> <head> <!-- 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. --> <meta charset=\"utf-8\"> <meta name=\"leadpages-served-by\" content=\"leadpages\"> <meta name=\"leadpages-serving-domain\" content=\"https://ixsystems.leadpages.co\"> <meta name=\"leadpages-stripe-public-key\" content=\"pk_live_R3OLguBtmUzvjaKuwtOa7Kvp\"> <meta name=\"leadpages-merchant-uuid\" content=\"kRYUiDye8gtbxvvVthNnkW\"> <meta charset=\"utf-8\"> <script> window.AnalyticsPropertyID = \"rMx3rsBoVfadWMfoLN2z5n\"; </script> <link rel=\"stylesheet\" type=\"text/css\" href=\"https://ixsystems.leadpages.co/static/lp1483572580/public/css/leadpage.css\"> <script> 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.\" } }; </script> <script type=\"text/javascript\" src=\"https://ixsystems.leadpages.co/static/lp1483572580/public/js/leadpage.js\"></script> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"> <style> @import url(https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css); </style> <link href=\"https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600\" rel=\"stylesheet\" type=\"text/css\"> <link rel=\"stylesheet\" href=\"https://ixsystems.leadpages.co/f//w5N55HkAEv%252BpK6kOFyh0KJ%252BRqC3JrztqsFbxy0Bc0iNSQCQTWrQMlWdvEiLQEXpYt8gPbmjzAk3KS4AbwJdag%253D%253D%7Ccss/normalize.min.css\"> <link rel=\"stylesheet\" type=\"text/css\" href=\"https://ixsystems.leadpages.co/f//w5N55HkAEv%252BpK6kOFyh0KJ%252BRqC3JrztqsFbxy0Bc0hcHiFxsb3VUc6tIAt5lPy8NykuAG8CXWo%253D%7Ccss/style.css\"> <script src=\"https://ixsystems.leadpages.co/f//w5N55HkAEv%252BpK6kOFyh0KJ%252BRqC3JrztqsFbxy0Bc0jINLrZD2o7qCJeTqzOuwVVkqSGeDambc2fKvbfDci7Jg%253D%253D%7Cjs/html5shiv.js\"></script> <script type=\"text/javascript\" src=\"http://www.omncdn.com/thankyou/CustomPage2/jeremyquinn/9/jquery.js\"></script> <script type=\"text/javascript\" src=\"http://www.omncdn.com/thankyou/CustomPage2/jeremyquinn/9/modernizer.js\"></script> <script type=\"text/javascript\" src=\"http://www.omncdn.com/thankyou/CustomPage2/jeremyquinn/9/function.js\"></script> <link href=\"http://www.omncdn.com/thankyou/CustomPage2/jeremyquinn/9/style.css\" type=\"text/css\" rel=\"stylesheet\"> <style> .popup { width: 80%; margin: 0 auto } #pop-head .head { font-family: \"Open Sans Condensed\"; font-size: 26px; color: #545555; font-weight: 700; line-height: 30px; text-align: center; margin: 20px auto 10px auto } .book-small { float: left; margin: -60px 10px 0 -50px } .popup input#fname, .popup input#email { width: 100%; height: 50px; font-size: 16px; line-height: 26px; color: #989898; padding: 0; margin: 5px auto; border: 1px solid #cacaca; text-align: center; -webkit-box-shadow: inset 1px 0px 10px 1px rgba(170, 170, 170, 0.3); box-shadow: inset 1px 0px 10px 1px rgba(170, 170, 170, 0.3) } #pop-footer { background-color: #d9d9d9; min-height: 57px; margin-top: 20px; padding-top: 10px; border-radius: 0 0 5px 5px; -webkit-border-radius: 0 0 5px 5px; -webkit-box-shadow: inset 0px 1px 5px 0px rgba(0, 0, 0, 0.2); box-shadow: inset 0px 1px 5px 0px rgba(0, 0, 0, 0.2) } #pop-footer p { font-size: 14px; color: #767677; text-align: center; margin-bottom: 0 } .popup .btn { font-family: 'Open Sans Condensed'; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3); filter: dropshadow(color=rgba(0, 0, 0, 0.3), offx=1, offy=1); background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #fed800), color-stop(1, #f5c800)); background: -moz-linear-gradient(center top, #fed800 5%, #f5c800 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fed800', endColorstr='#f5c800'); background-color: #fed800; display: block; margin: 8px auto 0 auto; position: relative; min-height: 58px; width: 100%; font-weight: 700; font-size: 30px; color: #fdfdfd; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border: none; padding: 10px 20px 15px; font-size: 30px; text-align: center } .popup .btn:hover { background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f5c800), color-stop(1, #fed800)); background: -moz-linear-gradient(center top, #f5c800 5%, #fed800 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5c800', endColorstr='#fed800'); background-color: #f5c800 } .popup .btn:active { position: relative; top: 1px } .popup .btn:after { content: '\\00BB' } .pop-up-footer-text { font-family: 'Open Sans'; color: #505050; font-size: 14px; text-align: center; margin: 5px auto; padding: 0 } .reveal-modal-bg { position: fixed; height: 100%; width: 100%; background: #000; background: rgba(0, 0, 0, .8); z-index: 100; display: none; top: 0; left: 0 } .reveal-modal { visibility: hidden; top: 100px; left: 45%; margin-left: -300px; width: 714px; min-height: 200px; background: #fff no-repeat -200px -80px; position: absolute; z-index: 101; -moz-border-radius: 10px; -moz-box-shadow: 0 0 10px rgba(0, 0, 0, .4); -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, .4); -box-shadow: 0 0 10px rgba(0, 0, 0, .4); border-radius: 5px; -webkit-border-radius: 5px } .reveal-modal.small { width: 200px; margin-left: -140px } .reveal-modal.medium { width: 400px; margin-left: -240px } .reveal-modal.large { width: 600px; margin-left: -340px } .reveal-modal.xlarge { width: 800px; margin-left: -440px } .reveal-modal .close-reveal-modal { font-size: 22px; line-height: .5; position: absolute; top: -30px; right: -40px; color: #aaa; text-shadow: 0 -1px 1px rbga(0, 0, 0, .6); font-weight: bold; cursor: pointer } @media only screen and (max-width:800px) { .reveal-modal { visibility: hidden; top: 200px; left: 45%; margin-left: -35%; width: 80% } } </style> <title>Introducing the TrueNAS X10</title> <meta content=\"\" name=\"description\"> <meta content=\"\" name=\"keywords\"> <meta content=\"146039073f72a2:12451c44c346dc\" name=\"leadpages-meta-id\"> <meta content=\"//ixsystems.leadpages.co\" name=\"leadpages-url\"> <script> (function(a, c, d, b, e, f) { a[d] = b; a[b] || (a[b] = function() { a[b].q = a[b].q || []; 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\"); center('create', 'rMx3rsBoVfadWMfoLN2z5n', 'rMx3rsBoVfadWMfoLN2z5n', { customId: 'lp-5735267667279872' }); </script> <script> center('send', 'view', 'leadpage', 5735267667279872) </script> </head> <body> <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;\"> <img src=\"//lh3.googleusercontent.com/nb_3u8pM7svZwqnWiF6zjIeHFljlncHDhq5RQwlArNfYZ31h7l4mkPSO2TjZYQZvY4Vm8MbaaRdKfBHIc9FWA2c=s0\" id=\"header-bg-image\" class=\"header-bg-img role-element leadstyle-image\"> <div class=\"header_title\"> <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> <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> </div> </header> <div class=\"main role-element leadstyle-container\"> <div class=\"main_left role-element leadstyle-container\"> <div class=\"media\"> <img src=\"//lh3.googleusercontent.com/PmXCCYDakVLqrLUEEpeQkY9boPvCAiEBYjVkHgXhQa4TOYQhL3oimNgX5ixI1VYF8Nv1oT6aseawRU32Y2PYrA=s0\" class=\"media__img floatL role-element leadstyle-image\" style=\"max-width: 176px;\"> <div class=\"media__body role-element leadstyle-container\"> <h3 class=\"role-element leadstyle-text\">Co-Hosted by TIM NAGLE</h3> <p class=\"main_left-title role-element leadstyle-text\"><strong>With Brad Meyer</strong></p> <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> </span> </span> </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> </span> </span> </p> </div> </div> </div> <div class=\"main_right border-left role-element leadstyle-container\"> <h3 class=\"role-element leadstyle-text\">Register free now!</h3> <p class=\"main_right-title role-element leadstyle-text\">It&#8217;s happening this [[WEEKDAY+next0]] ([[MMMM+next0]] [[DO+next0]]) at...</p> <div class=\"main_right-calendar role-element leadstyle-container\"> <p class=\"month role-element leadstyle-text\">[[WEEKDAY+next0]]</p> <p class=\"day role-element leadstyle-text\">[[DD+next0]]</p> </div> <div class=\"main_right-dates\"> <ul class=\"main_right-list role-element leadstyle-text\"> <li>[[time1+next0]] Pacific</li> <li>[[time1+next0+1HOUR]] Mountain</li> <li>[[time1+next0+2HOUR]] Central</li> <li>[[time1+next0+3HOUR]] Eastern</li> </ul> </div> </div> </div> <div class=\"section01\"> <div class=\"container role-element leadstyle-container\"> <div class=\"countdown-wrap role-element leadstyle-container\"> <h3 class=\"count-headline role-element leadstyle-text\">THIS WEBINAR WILL START IN</h3> <ul class=\"countdown role-element leadstyle-countdown\" data-timestamp=\"[[timestamp+next0]]000\"> <li> <div class=\"flap\"> <span id=\"days\" class=\"days\">0</span> </div> <p class=\"timeRefDays role-element leadstyle-text\">DAYS</p> </li> <li> <div class=\"flap\"> <span id=\"hours\" class=\"hours\">0</span> </div> <p class=\"timeRefHours role-element leadstyle-text\">HOURS</p> </li> <li> <div class=\"flap\"> <span id=\"minutes\" class=\"minutes\">0</span> </div> <p class=\"timeRefMinutes role-element leadstyle-text\">MINUTES</p> </li> <li> <div class=\"flap\"> <span id=\"seconds\" class=\"seconds\">0</span> </div> <p class=\"timeRefSeconds role-element leadstyle-text\">SECONDS</p> </li> </ul> </div> <a href=\"#\" data-reveal-id=\"myModal\" class=\"btn cta01 role-element leadstyle-link\">YES! Sign ME UP &#187;</a> </div> </div> <div class=\"section03\"> </div> <footer class=\"footer\"> <p class=\"footer_legal role-element leadstyle-text\"><a target=\"_blank\" href=\"https://www.ixsystems.com/privacy-policy/\">Privacy Policy</a></p> </footer> <link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.omncdn.com/thankyou/downloads/form.css\" /> <div id=\"myModal\" class=\"popup-container reveal-modal\"> <script type=\"text/javascript\" src=\"http://www.omncdn.com/thankyou/CustomPage/Geoff/mobile.js\"></script> <div id=\"leadpages-form-wrapper\"> <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\"> <a class=\"close-reveal-modal\"> <img src=\"//lh4.ggpht.com/eTzgQFXzaxNZzAsEGJyKl1WLVocESwwJFPPpfaoi3osmL1VKiZLMsq8jMnvIVhcHrnZYr4sJSK7CYhbOp5ce3Q=s0\"> </a> <div id=\"leadpages-form-header\"> <img id=\"leadpages-form-header-image\" src=\"https://ixsystems.leadpages.co/static/lp1481749521/img/leadbox_status_bar_gray3.gif\" /> <div id=\"leadpages-form-header-text\" style=\"font-family: Helvetica,Arial,sans-serif; font-size: 10pt; letter-spacing: 0em; display: block\"> Almost there! Please answer a few quick questions to save your spot. </div> </div> <div class=\"leadbox-content-wrapper\"> <div id=\"leadpages-form-title\" style=\"font-family: &#34;Open Sans&#34;,Helvetica,Arial,sans-serif; font-size: 18pt; letter-spacing: 0em; display: block\"> <div style=\"text-align: center\"> <strong>Enter your email address and click the button below to save your seat.</strong> </div> </div> <div id=\"leadpages-fieldset-wrapper\"> <fieldset id=\"leadpages-fieldset\"> <input name=\"inf_form_xid\" type=\"hidden\" value=\"4c75d0385a3b52fa2ef843bee2d7206d\" /> <input name=\"inf_form_name\" type=\"hidden\" value=\"Registrants\" /> <input name=\"infusionsoft_version\" type=\"hidden\" value=\"1.60.0.55\" /> <p style=\"text-align:center;font-family:'Open Sans',Helvetica,Arial,sans-serif;font-weight:normal;font-size:13px;\"> <input name=\"date_option\" type=\"radio\" value=\"option1|[[timestamp+next0]]\" checked>&#160;[[datetime+next0]] ([[timezone]]) <br> </p> <div class=\"control-group\" id=\"leadpages-container-inf-field-FirstName\"> <div class=\"controls\"> <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\" /> </div> <span class=\"error-container\" id=\"leadpages-error-inf-field-FirstName\"></span> </div> <div class=\"control-group\" id=\"leadpages-container-inf-field-Email\"> <div class=\"controls\"> <input type=\"email\" name=\"inf_field_Email\" value=\"\" id=\"inf-field-Email\" placeholder=\"Email\" data-source=\"leadpages-email\" data-role=\"email\" required=\"required\" /> </div> <span class=\"error-container\" id=\"leadpages-error-inf-field-Email\"></span> </div> <div class=\"control-group\"> <div class=\"controls\"> <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)\"> <div style=\"text-align: center\">Register Now <span class=\"raquo\">&#187;</span></div> </button> </div> </div> <div class=\"leadpages-spacer\">- -</div> </fieldset> </div> <div id=\"leadpages-privacy-policy\" style=\"font-family: &#34;Open Sans&#34;,Helvetica,Arial,sans-serif; font-size: 10pt; letter-spacing: \"> <div style=\"text-align: center\"> <i class=\"icon-lock\"></i> We hate SPAM and promise to keep your email address safe. </div> </div> </div> <div class=\"leadpages-spacer\">- -</div> <input name=\"inf_custom_SSWebinarDateTimeText\" type=\"hidden\" value=\"[[datetime]] ([[timezone]])\" /> <input name=\"inf_custom_SSWebinarTitle\" type=\"hidden\" value=\"[[title]]\" /> <input name=\"inf_custom_SSWebinarUrl\" type=\"hidden\" value=\"[[id]]\" /> </form> </div> <script type=\"text/javascript\" src=\"//my.leadpages.net/static/lp786/min/css_browser_selector.js\"></script> </div> <script src=\"http://omncdn.com/thankyou/html5/forhtml5.js\"></script> <script src=\"//my.leadpages.net/static/lp1483572580/min/tracking.js\"></script> <!-- Snippet used on StealthSeminar.com to integrate their form with our Marketo --> <script src=\"//app-sj20.marketo.com/js/forms2/js/forms2.min.js\"></script> <form id=\"mktoForm_1171\" style=\"display:none\"></form> <script> var marketyform; MktoForms2.loadForm(\"//app-sj20.marketo.com\", \"855-MUM-343\", 1171, function(form) { marketyform = form; marketyform.onSuccess(function() { jQuery(\"#leadpages-submit-button\").data(\"finish\", \"true\").click(); return false; }); }); jQuery.urlParam = function(name) { var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results == null) { return null; } else { return results[1] || 0; } } jQuery(document).ready(function() { jQuery(\"#leadpages-submit-button\").click(function(e) { if (jQuery(this).data(\"finish\") !== \"true\") { e.stopPropagation(); e.preventDefault(); var fn = jQuery(\"#inf-field-FirstName\").val(); var em = jQuery(\"#inf-field-Email\").val(); var ph = jQuery(\"#inf-field-Phone1\").val(); var st = jQuery(\"#inf-field-State\").val(); var fik = new Date(jQuery('input[name=date_option]:checked').val().split(\"|\")[1] * 1000); try { fik = fik.toISOString(); } catch (err) { fik = \"2001-01-01T00:00:00.000Z\"; } marketyform.addHiddenFields({ \"Email\": em, \"FirstName\": fn, \"Phone\": ph, \"State\": st, \"webinarTime\": fik, \"webinarDate\": fik.substring(0, 10), \"SSWebinarID\": jQuery.urlParam(\"id\") }); marketyform.submit(); } }); }); </script> <script type=\"text/javascript\"> (function() { var didInit = false; function initMunchkin() { if (didInit === false) { didInit = true; Munchkin.init('855-MUM-343'); } } var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = '//munchkin.marketo.net/munchkin.js'; s.onreadystatechange = function() { if (this.readyState == 'complete' || this.readyState == 'loaded') { initMunchkin(); } }; s.onload = initMunchkin; document.getElementsByTagName('head')[0].appendChild(s); })(); </script> </body> <!-- 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. --> </html>"; // result will be an iterator over tuples containing the start and end indices for each match in the string let result = regex.captures_iter(string); for mat in result { println!("{:?}", mat); } }

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 Rust, please visit: https://docs.rs/regex/latest/regex/