Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
Sponsors
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
Processing...

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#"(?m)(\.amenity_icon\..*)"|<h4>(.*)<\/h4>|<p>(.*)<\/p>"#).unwrap(); let string = "function LoadTooltips() { $(\".units_table .amenity_icon.icon_climate\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Temperature Controlled</h4><p>Units are heated and/or cooled. See manager for details.</p></div>\" } }); $(\".units_table .amenity_icon.icon_secure\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Secure Units</h4><p>Units protected with advanced security features.</p></div>\" } }); $(\".units_table .amenity_icon.icon_driveup\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Drive-up Access</h4><p>Plenty of room to park your vehicle in front of your storage unit.</p></div>\" } }); $(\".units_table .amenity_icon.icon_wine\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Wine Storage</h4><p>Specialty space with temperature control for wines.</p></div>\" } }); $(\".units_table .amenity_icon.icon_vehicle\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>RV, Car, Boat Parking</h4><p>Larger parking spaces for grown-up toys (indoors or outdoors).</p></div>\" } }); $(\".units_table .amenity_icon.icon_mobile\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Portable Storage</h4><p>We bring the unit to you and then store it at our secure location.</p></div>\" } }); $(\".units_table .amenity_icon.icon_twentyfour\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>24 Hour Access</h4><p>Units are accessible 24 hours a day.</p></div>\" } }); $(\".units_table .amenity_icon.icon_elevator\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Elevator Access</h4><p>Reduce heavy lifting and easily access your storage unit with our elevator.</p></div>\" } }); $(\".units_table .amenity_icon.icon_interior\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Interior Storage</h4><p>Indoor units provide added protection against weather and theft.</p></div>\" } }); $(\".units_table .amenity_icon.icon_ramp\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Ramp</h4><p>Ramps make it easy to maneuver dollies – which means less lifting for you!</p></div>\" } }); $(\".units_table .amenity_icon.icon_covered_parking\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Covered Parking</h4><p>Need protection from the elements? Check out our covered parking.</p></div>\" } }); $(\".units_table .amenity_icon.icon_uncovered_parking\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Uncovered Parking</h4><p>The most affordable option for parking your vehicle at our secure location.</p></div>\" } }); $(\".units_table .amenity_icon.icon_ground_floor\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Ground Floor</h4><p>Reduce your heavy lifting by taking advantage of our ground level units.</p></div>\" } }); $(\".units_table .amenity_icon.icon_upstairs\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Upstairs</h4><p>Looking to save money? Try our upstairs units for added savings.</p></div>\" } }); $(\".units_table .amenity_icon.icon_conference\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Conference Room</h4><p>Need a conference room for important client meetings? Take advantage of ours.</p></div>\" } }); $(\".units_table .amenity_icon.icon_fenced\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Fenced & Gated</h4><p>Perimeter fencing and gate entry give your unit 360 degree protection.</p></div>\" } }); $(\".units_table .amenity_icon.icon_kiosk\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>24 Hour Kiosk</h4><p>Rent storage units, make payments and more with our convenient 24 hour kiosk.</p></div>\" } }); $(\".units_table .amenity_icon.icon_resident\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Resident Manager</h4><p>Our resident manager lives onsite for added security and customer service.</p></div>\" } }); $(\".units_table .amenity_icon.icon_dollies\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Dollies/Handcarts</h4><p>Loading and unloading is easy with our complimentary handcarts & dollies.</p></div>\" } }); $(\".units_table .amenity_icon.icon_shipping\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Shipping Services</h4><p>Skip the long lines at the post office and ship your packages at our facility!</p></div>\" } }); $(\".units_table .amenity_icon.icon_callcenter\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Call Center</h4><p>Through our call center, you can reserve your unit when it's convenient for you.</p></div>\" } }); $(\".units_table .amenity_icon.icon_camera\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Security Cameras</h4><p>Fenced or gated area with recorded video surveillance.</p></div>\" } }); $(\".units_table .amenity_icon.icon_power\").tooltip({ track: false, delay: 0, showURL: false, left: -126, top: -100, bodyHandler: function () { return \"<div class=\\\"sidebar_tooltip\\\"><h4>Power</h4><p>Electrical outlets within or near your unit.</p></div>\" } }); }"; // 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/