Regular Expressions 101

Save & Share

  • Regex Version: ver. 4
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

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

/
/
i

Test String

Code Generator

Generated Code

$re = '/(\r\n|\n|\r|\t)/i'; $str = 'zweigeshoff@southwestern.com Zwarren@tristatetruck.com zoning@jeffersoncountytn.gov znunley@fpcnashville.org ZMYERS@NPMMG.COM zmart.stations@gmail.com ZLOVELADY@AZORINC.COM zlinkous0904@musfiber.com zjackson@guardianhealthcare.com zippyrf@gmail.com zimmermanm@wcschools.com zhou2209@hotmail.com zhashmi@ornlfcu.com ZGANN@TEMPLEHILLSGOLF.COM zfoster@spicerfirm.com zeisloftsb@msha.com zdut@aol.com Zc@poncelaw.com zazzyz@gmail.com zahuczkyj@wcschools.com zacharyebryant@mac.com zachary.moore@mnps.org zacharc@wcschools.com zac.seiber@ttecasting.com YVONNER@CAPITOLCASH1.COM yvonne.rossi@starpt.COM yvonne.leonard@cumulus.com YVONNE.CHELTON@MNPS.ORG Yvette.Robinson@Nashville.gov yroebuck@pstcc.edu YPARR@UTM.EDU YOUNKERJ@BELLSOUTH.NET YOUNGSHIL27@YAHOO.COM youngs.animal.hospital@comcast.net Youngde@rcschools.net youngbs@msha.com youngab@msha.com young.vickiel@yahoo.com younce@crossroadstn.com yorkke@msha.com yohel@rcschools.net YMJ@ROWLANDANDCARTER.COM yjoyner@ci.collierville.tn.us yjones@tcatcovington.edu yhanash@comcast.net YHALL@OLDREPUBLICTITLE.COM yfrazier@mmc.edu yercheckta@msha.com YEAGER.KRISTEN@COGENTHMG.COM YDONATTO@OAKWOOD.EDU ycutler@bellsouth.net ycollier@aol.com YCARPENTER@VOLUNTEEREXPRESS.COM yateskh@msha.com yarberbf@msha.com yakima.wa@carehere.com xxx xcovington14@yahoo.com XAVIERA.WASHINGTON@MNPS.ORG WynneJL2@msha.com wyelverton@madisoncountyal.gov wyattj@rcschools.net wyatt@suppliesnetwork.com WWW.VERTKSOLUTIONSINC.COM WWW.VERTEKSOLUTIONSINC.COM WWW.TURNERCONSTRUCTION.COM WWW.TLSINC.COM WWW.THEHANNAHCOMPANY.COM WWW.TEAMNOXCUSE.COM WWW.SPICERFIRM.COM WWW.SENTRYSTEEL.COM www.northsidedisiples.com WWW.MONARCHMORTGAGETN.COM WWW.LIGHTWAVESOLARELECTRIC.COM www.innovative-eyecare.com www.holisticalabama.com www.decantermachine.com WWW.BACKFIELDINMOTION.ORG www.athens-orthodontics.com www.allneedzrental.com WWW.ALLERGYASC.COM WWTPLANT@PULASKI-TN.COM WWHITESIDE@HARDINANDPARKES.COM WWHITE@CBCDECATUR.ORG wweaver@alphapetinc.com wwatkins@rutherfordcountytn.gov wwasserman@vofonline.org Wwalls@Systemstechnologyco.com WVENABLE@CITYOFSCOTTSBORO.COM WVAUGHN@OAKWOOD.EDU wurmserbp@msha.com WTROPER@HSVUTIL.ORG wths@bellsouth.net wthayer@dyersburgtn.gov WTERRY@DECATUR-AL.GOV '; preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 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