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
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • 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

/
/
gm

Test String

Code Generator

Generated Code

$re = '/\s*<div\sid=\"olpOfferList[\s\S]*?<span\sclass=\"a-size-large a-color-price olpOfferPrice a-text-bold[\s\S]*?>[\s\S]*?\s*.(.*?)\s*<\/span>/m'; $str = '<div id="olpOfferList" class="a-section olpOfferList"> <div class="a-section a-padding-small"> <div aria-label="More buying choices" aria-readonly="true" class="a-section a-spacing-double-large" role="grid"> <div class="a-row a-spacing-mini" role="row"> <div class="a-column a-span2" role="columnheader"> <span class="a-color-secondary a-text-bold"> Price + Shipping </span> </div> <div class="a-column a-span3" role="columnheader"> <span class="a-color-secondary a-text-bold"> Condition </span> (<a href="/gp/help/customer/display.html/ref=olp_cg_pop?ie=UTF8&amp;nodeId=200143590&amp;pop-up=1" target="conditionGuidelinesFrameOLP" onclick="return amz_js_PopWin(\'/gp/help/customer/display.html/ref=olp_cg_pop?ie=UTF8&amp;nodeId=200143590&amp;pop-up=1\',\'conditionGuidelinesFrameOLP\',\'width=550,height=550,resizable=1,scrollbars=1,toolbar=0,status=0\');">Learn more</a>) </div> <div class="a-column a-span3" role="columnheader"> <span class="a-color-secondary a-text-bold"> Delivery </span> </div> <div class="a-column a-span2" role="columnheader"> <span class="a-color-secondary a-text-bold"> Seller Information </span> </div> <div class="a-column a-span2 a-span-last" role="columnheader"> <span class="a-color-secondary a-text-bold"> Buying Options </span> </div> </div> <hr class="a-spacing-mini a-divider-normal"> <div class="a-row a-spacing-mini olpOffer" role="row"> <div class="a-column a-span2 olpPriceColumn" role="gridcell"> <span class="a-size-large a-color-price olpOfferPrice a-text-bold"> $33.43 </span> <span class="supersaver"><i class="a-icon a-icon-prime" role="img" aria-label="Amazon Prime TM"></i></span> <p class="olpShippingInfo"> <span class="a-color-secondary"> &amp; <b>FREE Shipping</b> <a href="/gp/help/customer/display.html/ref=mk_gship_olp?ie=UTF8&amp;nodeId=527692&amp;pop-up=1" target="SuperSaverShipping" onclick="return amz_js_PopWin(\'/gp/help/customer/display.html/ref=mk_gship_olp?ie=UTF8&amp;nodeId=527692&amp;pop-up=1\',\'SuperSaverShipping\',\'width=550,height=550,resizable=1,scrollbars=1,toolbar=0,status=0\');">Details</a> </span> </p> </div> <div class="a-column a-span3 olpConditionColumn" role="gridcell"> <div id="offerCondition" class="a-section a-spacing-small"> <span id="olpNew" class="a-size-medium olpCondition a-text-bold"> New </span> </div> </div> <div class="a-column a-span3 olpDeliveryColumn" role="gridcell"> <div class="a-popover-preload" id="a-popover-fbaPopover"> <ul id="popOverListHorizonte" class="a-unordered-list a-vertical a-spacing-mini"> <li><span class="a-list-item"> Stored, Packed &amp; Shipped by Amazon! </span></li> <li><span class="a-list-item"> Eligible for Free Shipping </span></li> <li><span class="a-list-item"> Amazon Customer Service 24 x 7 </span></li> <li><span class="a-list-item"> Track your delivery to your door </span></li> </ul> <div id="olpLearnMoreLink1" class="a-section a-text-right"> <a href="/gp/help/customer/display.html?ie=UTF8&amp;pop-up=1&amp;nodeId=106096011&amp;_ref=olp_offerlisting" target="AmazonHelp" onclick="return amz_js_PopWin(this.href,\'AmazonHelp\',\'width=550,height=550,resizable=1,scrollbars=1,toolbar=0,status=0\');"> Learn more </a> </div> </div> <div id="olpBadgeContainerDiv1" class="a-section a-spacing-none olpBadgeContainer"> <div id="olpBadgeDiv1" class="a-section olpBadge"> <span class="a-declarative" data-action="a-popover" data-a-popover="{&quot;activate&quot;:&quot;onclick&quot;,&quot;name&quot;:&quot;fbaPopover&quot;}" id="fulfilledByAmazonPopOver1"> <a id="fulfilledByAmazonPopOver1" href="javascript:void(0)" class="a-popover-trigger a-declarative olpFbaPopoverTrigger"> Fulfillment by Amazon <i class="a-icon a-icon-popover"></i></a> </span> </div> </div> <p class="a-spacing-mini olpAvailability"> </p><ul class="a-unordered-list a-vertical olpFastTrack"> <li><span class="a-list-item"> <span id="ftm_Q%2BXEy5I26O%2FeGlS%2FJ5Ek7qkZoVXz6Ud5CNjDsS151ZC036bsKKlisesK4kKU4GPVv1BL5%2FwAI%2F4gDTEq%2F%2FIOfVMNc%2B7Lo%2B2nExrmYo8Arxn26Tv%2F%2BFui4JBuXWhn1xRVF%2F%2F8EmGEsCbiUv8%2F2EAxCA%3D%3D">Want it delivered Monday, December 31? <span id="shippingMessage_ftinfo_olp_1">Order it in the next <span id="ftc_Q%2BXEy5I26O%2FeGlS%2FJ5Ek7qkZoVXz6Ud5CNjDsS151ZC036bsKKlisesK4kKU4GPVv1BL5%2FwAI%2F4gDTEq%2F%2FIOfVMNc%2B7Lo%2B2nExrmYo8Arxn26Tv%2F%2BFui4JBuXWhn1xRVF%2F%2F8EmGEsCbiUv8%2F2EAxCA%3D%3D" style="color: #006600;">11 hours and 12 minutes</span>, and choose <b>Two-Day Shipping</b> at checkout.</span> <a href="/gp/help/customer/display.html/ref=ftinfo_olp_1?ie=UTF8&amp;nodeId=3510241&amp;pop-up=1" target="_blank" onclick="return amz_js_PopWin(\'/gp/help/customer/display.html/ref=ftinfo_olp_1?ie=UTF8&amp;nodeId=3510241&amp;pop-up=1\',\'_blank\',\'width=750,height=600,resizable=1,scrollbars=1,toolbar=1,status=1\');">See details</a> </span> </span></li> <li><span class="a-list-item"> <a href="/gp/aag/details/ref=olp_merch_ship_1?ie=UTF8&amp;asin=B00MC3R3M6&amp;seller=ATVPDKIKX0DER&amp;sshmPath=shipping-rates#aag_shipping">Shipping rates</a> and <a href="/gp/aag/details/ref=olp_merch_return_1?ie=UTF8&amp;asin=B00MC3R3M6&amp;seller=ATVPDKIKX0DER&amp;sshmPath=returns#aag_returns">return policy</a>. </span></li> </ul> <p></p> </div> <div class="a-column a-span2 olpSellerColumn" role="gridcell"> <h3 class="a-spacing-none olpSellerName"> <span class="a-size-medium a-text-bold"> <a href="/gp/aag/main/ref=olp_merch_name_1?ie=UTF8&amp;asin=B00MC3R3M6&amp;isAmazonFulfilled=1&amp;seller=A3HQTMO5D4RM39">gbravo-com</a> </span> </h3> <p class="a-spacing-small"> <i class="a-icon a-icon-star a-star-5"><span class="a-icon-alt">5 out of 5 stars</span></i> <a href="/gp/aag/main/ref=olp_merch_rating_1?ie=UTF8&amp;asin=B00MC3R3M6&amp;isAmazonFulfilled=1&amp;seller=A3HQTMO5D4RM39"><b>98% positive</b></a> over the past 12 months. (480 total ratings) <br> </p> </div> <div class="a-column a-span2 olpBuyColumn a-span-last" role="gridcell"> <div class="a-button-stack"> <form method="post" action="/gp/item-dispatch/ref=olp_atc_new_1" class="a-spacing-none"> <input type="hidden" name="session-id" value="144-9672509-5121614"> <input type="hidden" name="qid"> <input type="hidden" name="sr"> <input type="hidden" name="signInToHUC" value="0" id="signInToHUC"> <input type="hidden" name="metric-asin.B00MC3R3M6" value="1"> <input type="hidden" name="registryItemID.1"> <input type="hidden" name="registryID.1"> <input type="hidden" name="itemCount" value="1"> <input type="hidden" name="offeringID.1" value="Q%2BXEy5I26O%2FeGlS%2FJ5Ek7qkZoVXz6Ud5CNjDsS151ZC036bsKKlisesK4kKU4GPVv1BL5%2FwAI%2F4gDTEq%2F%2FIOfVMNc%2B7Lo%2B2nExrmYo8Arxn26Tv%2F%2BFui4JBuXWhn1xRVF%2F%2F8EmGEsCbiUv8%2F2EAxCA%3D%3D"> <input type="hidden" name="isAddon" value="1"> <span class="a-declarative" data-action="olp-click-log" data-olp-click-log="{&quot;subtype&quot;:&quot;main&quot;,&quot;type&quot;:&quot;addToCart&quot;}"> <span class="a-button a-button-normal a-spacing-micro a-button-primary a-button-icon" id="a-autoid-13"><span class="a-button-inner"><i class="a-icon a-icon-cart"></i><input name="submit.addToCart" class="a-button-input" type="submit" value="Add to cart" aria-labelledby="a-autoid-13-announce"><span class="a-button-text" aria-hidden="true" id="a-autoid-13-announce"> Add to cart <span class="a-offscreen" "="">from seller gbravo-com and price $33.43</span> </span></span></span> </span> </form> </div> </div> </div> <hr class="a-spacing-mini a-divider-normal"> <div class="a-row a-spacing-mini olpOffer" role="row"> <div class="a-column a-span2 olpPriceColumn" role="gridcell"> <span class="a-size-large a-color-price olpOfferPrice a-text-bold"> $73.27 </span> <p class="olpShippingInfo"> <span class="a-color-secondary"> &amp; <b>FREE Shipping</b> </span> </p> </div> <div class="a-column a-span3 olpConditionColumn" role="gridcell"> <div id="offerCondition" class="a-section a-spacing-small"> <span id="olpNew" class="a-size-medium olpCondition a-text-bold"> New </span> </div> </div> <div class="a-column a-span3 olpDeliveryColumn" role="gridcell"> <p class="a-spacing-mini olpAvailability"> </p><ul class="a-unordered-list a-vertical olpFastTrack"> <li><span class="a-list-item"> <div aria-live="polite" data-a-expander-collapsed-height="60" class="a-expander-collapsed-height a-row a-expander-container a-spacing-base a-expander-partial-collapse-container olpAvailabilityExpander" style="max-height:60px; _height:60px"> <div aria-expanded="false" class="a-expander-content a-expander-partial-collapse-content"> <b>Arrives between</b> January 11-22. </div> <div class="a-expander-header a-expander-partial-collapse-header" style="opacity: 0; display: none;"><div class="a-expander-content-fade"></div><a href="javascript:void(0)" data-action="a-expander-toggle" class="a-declarative" data-a-expander-toggle="{&quot;allowLinkDefault&quot;:true, &quot;expand_prompt&quot;:&quot;Read more&quot;, &quot;collapse_prompt&quot;:&quot;Show less&quot;}"><i class="a-icon a-icon-extender-expand"></i><span class="a-expander-prompt">Read more </span></a></div> </div> </span></li> <li><span class="a-list-item"> Ships from LA, United States. </span></li> <li><span class="a-list-item"> <a href="/gp/aag/details/ref=olp_merch_ship_2?ie=UTF8&amp;asin=B00MC3R3M6&amp;seller=A30PTS3CAUXNFU&amp;sshmPath=shipping-rates#aag_shipping">Shipping rates</a> and <a href="/gp/aag/details/ref=olp_merch_return_2?ie=UTF8&amp;asin=B00MC3R3M6&amp;seller=A30PTS3CAUXNFU&amp;sshmPath=returns#aag_returns">return policy</a>. </span></li> </ul> <p></p> </div> <div class="a-column a-span2 olpSellerColumn" role="gridcell"> <h3 class="a-spacing-none olpSellerName"> <span class="a-size-medium a-text-bold"> <a href="/gp/aag/main/ref=olp_merch_name_2?ie=UTF8&amp;asin=B00MC3R3M6&amp;isAmazonFulfilled=0&amp;seller=A30PTS3CAUXNFU">Top Notch iDeals</a> </span> </h3> <p class="a-spacing-small"> <i class="a-icon a-icon-star a-star-5"><span class="a-icon-alt">5 out of 5 stars</span></i> <a href="/gp/aag/main/ref=olp_merch_rating_2?ie=UTF8&amp;asin=B00MC3R3M6&amp;isAmazonFulfilled=0&amp;seller=A30PTS3CAUXNFU"><b>100% positive</b></a> over the past 12 months. (113 total ratings) <br> </p> </div> <div class="a-column a-span2 olpBuyColumn a-span-last" role="gridcell"> <div class="a-button-stack"> <form method="post" action="/gp/item-dispatch/ref=olp_atc_new_2" class="a-spacing-none"> <input type="hidden" name="session-id" value="144-9672509-5121614"> <input type="hidden" name="qid"> <input type="hidden" name="sr"> <input type="hidden" name="signInToHUC" value="0" id="signInToHUC"> <input type="hidden" name="metric-asin.B00MC3R3M6" value="1"> <input type="hidden" name="registryItemID.1"> <input type="hidden" name="registryID.1"> <input type="hidden" name="itemCount" value="1"> <input type="hidden" name="offeringID.1" value="Q%2BXEy5I26O%2FeGlS%2FJ5Ek7qkZoVXz6Ud5Tay9YzLDldgNMR1SZrrtV%2BtQgSXCw3lp%2FU8wErFBO8P8OJ1cwEDOkW2f3XZV0ej09NhlQ%2Fhmb0dRgKUv9LHZs5eFlyyzBIH6nT%2Fue8I74clrbWaTgsHGrHa0O4Fkl7ly"> <input type="hidden" name="isAddon" value="1"> <span class="a-declarative" data-action="olp-click-log" data-olp-click-log="{&quot;subtype&quot;:&quot;main&quot;,&quot;type&quot;:&quot;addToCart&quot;}"> <span class="a-button a-button-normal a-spacing-micro a-button-primary a-button-icon" id="a-autoid-14"><span class="a-button-inner"><i class="a-icon a-icon-cart"></i><input name="submit.addToCart" class="a-button-input" type="submit" value="Add to cart" aria-labelledby="a-autoid-14-announce"><span class="a-button-text" aria-hidden="true" id="a-autoid-14-announce"> Add to cart <span class="a-offscreen" "="">from seller Top Notch iDeals and price $73.27</span> </span></span></span> </span> </form> </div> </div> </div> <hr class="a-spacing-mini a-divider-normal"> <div class="a-row a-spacing-mini olpOffer" role="row"> <div class="a-column a-span2 olpPriceColumn" role="gridcell"> <span class="a-size-large a-color-price olpOfferPrice a-text-bold"> $121.00 </span> <p class="olpShippingInfo"> <span class="a-color-secondary"> &amp; <b>FREE Shipping</b> </span> </p> </div> <div class="a-column a-span3 olpConditionColumn" role="gridcell"> <div id="offerCondition" class="a-section a-spacing-small"> <span id="olpNew" class="a-size-medium olpCondition a-text-bold"> New </span> </div> </div> <div class="a-column a-span3 olpDeliveryColumn" role="gridcell"> <p class="a-spacing-mini olpAvailability"> </p><ul class="a-unordered-list a-vertical olpFastTrack"> <li><span class="a-list-item"> <div aria-live="polite" data-a-expander-collapsed-height="60" class="a-expander-collapsed-height a-row a-expander-container a-spacing-base a-expander-partial-collapse-container olpAvailabilityExpander" style="max-height:60px; _height:60px"> <div aria-expanded="false" class="a-expander-content a-expander-partial-collapse-content"> <b>Arrives between</b> January 7-10. </div> <div class="a-expander-header a-expander-partial-collapse-header" style="opacity: 0; display: none;"><div class="a-expander-content-fade"></div><a href="javascript:void(0)" data-action="a-expander-toggle" class="a-declarative" data-a-expander-toggle="{&quot;allowLinkDefault&quot;:true, &quot;expand_prompt&quot;:&quot;Read more&quot;, &quot;collapse_prompt&quot;:&quot;Show less&quot;}"><i class="a-icon a-icon-extender-expand"></i><span class="a-expander-prompt">Read more </span></a></div> </div> </span></li> <li><span class="a-list-item"> Ships from CA, United States. </span></li> <li><span class="a-list-item"> <a href="/gp/aag/details/ref=olp_merch_ship_3?ie=UTF8&amp;asin=B00MC3R3M6&amp;seller=A11M9NVQAFQWJR&amp;sshmPath=shipping-rates#aag_shipping">Shipping rates</a> and <a href="/gp/aag/details/ref=olp_merch_return_3?ie=UTF8&amp;asin=B00MC3R3M6&amp;seller=A11M9NVQAFQWJR&amp;sshmPath=returns#aag_returns">return policy</a>. </span></li> </ul> <p></p> </div> <div class="a-column a-span2 olpSellerColumn" role="gridcell"> <h3 class="a-spacing-none olpSellerName"> <span class="a-size-medium a-text-bold"> <a href="/gp/aag/main/ref=olp_merch_name_3?ie=UTF8&amp;asin=B00MC3R3M6&amp;isAmazonFulfilled=0&amp;seller=A11M9NVQAFQWJR">MARCAS Brands.</a> </span> </h3> <p class="a-spacing-small"> <i class="a-icon a-icon-star a-star-4-5"><span class="a-icon-alt">4.5 out of 5 stars</span></i> <a href="/gp/aag/main/ref=olp_merch_rating_3?ie=UTF8&amp;asin=B00MC3R3M6&amp;isAmazonFulfilled=0&amp;seller=A11M9NVQAFQWJR"><b>89% positive</b></a> over the past 12 months. (342 total ratings) <br> </p> </div> <div class="a-column a-span2 olpBuyColumn a-span-last" role="gridcell"> <div class="a-button-stack"> <form method="post" action="/gp/item-dispatch/ref=olp_atc_new_3" class="a-spacing-none"> <input type="hidden" name="session-id" value="144-9672509-5121614"> <input type="hidden" name="qid"> <input type="hidden" name="sr"> <input type="hidden" name="signInToHUC" value="0" id="signInToHUC"> <input type="hidden" name="metric-asin.B00MC3R3M6" value="1"> <input type="hidden" name="registryItemID.1"> <input type="hidden" name="registryID.1"> <input type="hidden" name="itemCount" value="1"> <input type="hidden" name="offeringID.1" value="Q%2BXEy5I26O%2FeGlS%2FJ5Ek7qkZoVXz6Ud5DtE7fw93Cz0q%2B2cCabCQ9arlcZUKqQeF3s5FmkyD23D8m%2FW1QCS6S2lqLg9w0Uw3%2FFheA9ELY7VWCZJRhASKtt09rsNqXk%2B3YPv5IaP7YzJjkmqfm7uEASExnw8zM60F"> <input type="hidden" name="isAddon" value="1"> <span class="a-declarative" data-action="olp-click-log" data-olp-click-log="{&quot;subtype&quot;:&quot;main&quot;,&quot;type&quot;:&quot;addToCart&quot;}"> <span class="a-button a-button-normal a-spacing-micro a-button-primary a-button-icon" id="a-autoid-15"><span class="a-button-inner"><i class="a-icon a-icon-cart"></i><input name="submit.addToCart" class="a-button-input" type="submit" value="Add to cart" aria-labelledby="a-autoid-15-announce"><span class="a-button-text" aria-hidden="true" id="a-autoid-15-announce"> Add to cart <span class="a-offscreen" "="">from seller MARCAS Brands. and price $121.00</span> </span></span></span> </span> </form> </div> </div> </div> <script> if (typeof uet == \'function\') { uet(\'cf\'); } </script> <script language="Javascript1.2" type="text/javascript"> <!-- var g_ftTSH = new Object(); var g_ftSLH = new Object(); g_ftSLH[\'Q%2BXEy5I26O%2FeGlS%2FJ5Ek7qkZoVXz6Ud5CNjDsS151ZC036bsKKlisesK4kKU4GPVv1BL5%2FwAI%2F4gDTEq%2F%2FIOfVMNc%2B7Lo%2B2nExrmYo8Arxn26Tv%2F%2BFui4JBuXWhn1xRVF%2F%2F8EmGEsCbiUv8%2F2EAxCA%3D%3D\'] = 40370; function getTimeRemainingString( hours, minutes ) { var hourString = ( hours == 1 ? "hour" : "hours" ); var minuteString = ( minutes == 1 ? "minute" : "minutes" ); return hours + " " + hourString + " and " + minutes + " " + minuteString; } var FT_currentTime = new Date(); var FT_currentTimeInSecs = FT_currentTime.getHours() * 3600 + FT_currentTime.getMinutes() * 60 + FT_currentTime.getSeconds(); for (var i in g_ftSLH) { g_ftTSH[i] = g_ftSLH[i] + FT_currentTimeInSecs; } FT_displayCountdown(); function FT_displayCountdown() { if (!document.layers && !document.all && !document.getElementById) { return; } var FT_newCurrentTime = new Date(); var FT_actualSeconds = FT_newCurrentTime.getHours() * 3600 + FT_newCurrentTime.getMinutes() * 60 + FT_newCurrentTime.getSeconds(); for (var i in g_ftTSH) { var FT_remainSeconds = g_ftTSH[i] - FT_actualSeconds; if (FT_remainSeconds < 1) { if (document.getElementById("ftm_"+i)) { document.getElementById("ftm_"+i).style.display = "none"; } } else { var FT_secondsPerDay = 86400; var FT_daysLong = FT_remainSeconds / FT_secondsPerDay; var FT_days = Math.floor(FT_daysLong); var FT_hoursLong = (FT_daysLong - FT_days) * 24; var FT_hours = Math.floor(FT_hoursLong); var FT_minsLong = (FT_hoursLong - FT_hours) * 60; var FT_mins = Math.floor(FT_minsLong); var FT_secsLong = (FT_minsLong - FT_mins) * 60; var FT_secs = Math.floor(FT_secsLong); if (FT_days > 0) { FT_hours = (FT_days * 24) + FT_hours; } var ftCountdown = getTimeRemainingString( FT_hours, FT_mins ); if (document.getElementById("ftc_"+i)) { document.getElementById("ftc_"+i).innerHTML = ftCountdown; } } } window.setTimeout("FT_displayCountdown()", 60000); } //--> </script> </div> <input type="hidden" name="" value="/gp/offer-listing/B00MC3R3M6/ref=olp_glow_refresh?ie=UTF8&amp;f_all=true" id="globalLocationWidgetRefreshUrl"> </div> </div>'; 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