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

/
/
gmi

Test String

Code Generator

Generated Code

$re = '/(View original content:.*$)|((?:Contacts|contact:).*$)|(?:^SOURCE\s?(?:.*){0,20}"?$)|(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Oct|Nov|Dec)\.? ?(?:\d+){1,2},? ?\d{4} ?\d{1,2}:\d{1,2} ?(?:AM|PM)? (?:\w{3}))|(Reads: [\d,]+)|(^Click on \w for \w+$)|(\[Video\])|(?:Advertisement)|("?For more information ?(?:about \w+)?,?\s?(?:(?:please)?\s?visit).*)|(For more information:.*)|(?:View original content with multimedia:? ?(?:https?|www).*)|(?:\(Bloomberg\)—)|("?To contact the reporter on this story:? ?.*)|(?:Bloomberg$)|(?:\[CO\] ?–.*$)|(?:For complete information,? please visit:?.*$)|\((?:(?=(\w+)? ?Photo)[^()]*)\)|(?:(?=(\w+)? ?Video)[^()]*)\)|(?:^Copyright ?\d{4}.*)|(?:[—–])|(?:Press release)|(?:Read more from.*)|(?:Topics:.*)|(?:SEE ALSO:.*)|(?:^copyright .*$)|(?:All rights reserved.*)|(?:Photo credit:?.*)|(?:(?:January|Febuary|March|April|May|June|July|August|September|October|November|December),? ?\d{2},? [\d:]{1,4} ?(?:am|pm|a\.m\.?|p\.m\.?):?)|(By:.*)|(?:View source version.*$)|(?:\* Trademark and.*)|(?:^Irish Independent"?$)|(?:^Posted$)|(?:^(?:January|Febuary|March|April|May|June|July|August|September|October|November|December) ?\d{1,2}, ?\d{2,4})|(?:^CLICK HERE to.*$)|(?:[\w\.-]+@\w+\.[\w]{3})|(?:Follow ?@[\w\.]+)|([\d-]{10,12})|(?:\(#\d+\))(?# remove this for twitter)|(?:(?:Phone|Email):)/mi'; $str = '"""We are pleased to welcome Laurie and Michelle, who each bring to the firm a strong background and many fruitful relationships in the broker-dealer industry,"" said H. Michael Schwartz, chief executive officer of SmartStop. ""Their history of success and deep understanding make them valuable additions to our team."" Levassar brings 19 years of experience to her role at Select Capital Corporation. Prior to joining the company, she served as vice president of strategic accounts with NorthStar Securities, where she was responsible for expanding distribution and strengthening the firm\'s broker-dealer relationships on the West Coast and central region. Levassar earned a bachelor\'s degree from Texas A&M University. Moore, who has 17 years of experience, previously served as senior vice president, national accounts for SC Distributors. She was responsible for building and managing ongoing relationships with broker-dealer partners and providing sales, marketing and due diligence support for its registered investment products. Moore earned a bachelor\'s degree from the University of California, Davis and an M.B.A. from Pepperdine University. She serves on the education and women\'s initiatives network committees for the Investment Program Association. About Select Capital Corporation and SmartStop Asset Management, LLC (SmartStop) Select Capital Corporation is the dealer manager for private offerings and public non-traded real estate investment trusts sponsored by SmartStop Asset Management, LLC, a diversified real estate company focused on self storage assets, along with student and senior housing. SmartStop has approximately $1.5 billion of real estate assets under management, including 113 self storage facilities located throughout the United States and Toronto, Canada, comprised of approximately 71,000 units and 8.2 million rentable square feet. SmartStop\'s real estate portfolio also includes five student housing communities with approximately 2,800 beds and 1.1 million square feet of space, as well as three senior housing communities with approximately 350 beds and 250,000 rentable square feet of space. SmartStop is the sponsor of SST IV, Strategic Storage Trust II, Inc., and Strategic Storage Growth Trust, Inc., all public non-traded REITs focusing on self storage assets. The facilities offer affordable and accessible storage units for residential and commercial customers. In addition, they offer secure interior and exterior storage units as well as outside storage areas for vehicles, RVs and boats. Additional information regarding SmartStop is available at www.SAM.com and more information regarding SmartStop® Self Storage in the United States and Canada is available at www.smartstopselfstorage.com. Contacts Julie Leber Lauren Burgos Spotlight Marketing Communications Spotlight Marketing Communications 949.427.5172 ext. 703 949.427.5172, ext. 702 julie@spotlightmarcom.com lauren@spotlightmarcom.com View original content with multimedia:http://www.prnewswire.com/news-releases/select-capital-corporation-expands-national-accounts-team-with-hire-of-laurie-levassar-and-michelle-moore-300624400.html SOURCE Select Capital Corporation"'; 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