Regular Expressions 101

Save & Manage Regex

  • Current Version: 3
  • 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
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]
  • Character class intersection
    [\w&&[^\d]]
  • 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"(?mi)^(?<title>(?![(\[]).+?)((\W|_))(\(?\b(?<edition>(((Recut.|Extended.|Ultimate.)?(Director.?s|Collector.?s|Theatrical|Ultimate|Extended|Despecialized|(Special|Rouge|Final|Assembly|Imperial|Diamond|Signature|Hunter|Rekall)(?=(.(Cut|Edition|Version)))|\d{2,3}(th)?.Anniversary)(?:.(Cut|Edition|Version))?(.(Extended|Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit))?|((Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit|Restored|((2|3|4)in1))))))\b\)?.{1,3})?(?:(?<!(19|20)\d{2}.*?|((The([-_. ]Good)?)|La|Aleksei)[-_. ])(German|French|TrueFrench))(?!.*?(German|French|TrueFrench|[-_. ].+?(19|20)\d{2}))[-_. ](?=((19|20)\d{2}|$|(DL|BluRay|WEB|WebHD|WebRip|720p|1080p|2160p|E?AC3D?|Subbed|DTS(-HD)?|COMPLETE|DVDR|HDTV|HDTVRip|PAL|DVD9|ML|MULTi|READNFO|UHD|BDRIP|DOKU|DD|SUBBED|DUBBED|DV|INTERNAL|iNT|BDRiP|HEVC|AVC|3D|DVD|S?VCD|DVDRiP|TS|LD|CAM|\(?\b(?<edition2>(((Recut.|Extended.|Ultimate.)?(Director.?s|Collector.?s|Theatrical|Ultimate|Extended|Despecialized|(Special|Rouge|Final|Assembly|Imperial|Diamond|Signature|Hunter|Rekall)(?=(.(Cut|Edition|Version)))|\d{2,3}(th)?.Anniversary)(?:.(Cut|Edition|Version))?(.(Extended|Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit))?|((Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit|Restored|((2|3|4)in1))))))\b\)?)))(?<year>(19|20)\d{2})?(.*?)(\W+|_|$)(?!\\)").unwrap(); let string = "//Tests From Github PR 211.2018.MULTi.TRUEFRENCH.1080p.BluRay.DTS-HDMA.x264-EXTREME 8mm.1999.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.x264-YOP 8mm.1999.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.x264-YOP A.Coeur.Vaillant.Rien.D.Impossible.1991.TRUEFRENCH.1080p.HDTV.AC3.X264-QWERTZ A.Quiet.Place.Part.11.2020.TRUEFRENCH.720p.BluRay.x264.AC3-EXTREME A.Walk.ToRemember.2002.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.x264-DELICIOUS A.Walk.To.Remember.2002.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.x264-DELICIOUS About.Adam.2001.TRUEFRENCH.1080p.AMZN.WEB-DL.H264-BOLTON08 Acusada.2019.MULTi.TRUEFRENCH.1080p.WEB-DL.H264.AC3-STVFRV Acusada2019.TRUEFRENCH.HDRiP.x264.AC3-STVFRV Addams.Family.Values.1993.CUSTOM.MULTi.TRUEFRENCH.1080p.BluRay.REMUX.AVC.VFF.AC3.2.0.VO.DTS-HDMA.5.1-Goldenyann After.We.Collided.2020.TRUEFRENCH.720p.BluRay.x264-UTT After.We.Fell.2021.MULTi.TRUEFRENCH.1080p.BluRay.DTS.x264-UTT After.We.Fell.2021.MULTi.TRUEFRENCH.1080p.BluRay.x264-UTT After.We.Fell.2021.MULTi.TRUEFRENCH.1080p.HDLight.x264.AC3-EXTREME After.We.Fell.2021.MULTi.TRUEFRENCH.1080p.WEB.H264-EXTREME Dune.Part.One.2021.TRUEFRENCH.BDRip.x264-Ulysse Dune.Part.One.2021.TRUEFRENCH.720p.BluRay.x264-Ulysse Dune.Part.One.2021.MULTI.TRUEFRENCH.1080p.BluRay.x264-Ulysse Dune.Part.One.2021.MULTI.TRUEFRENCH.2160p.UHD.BluRay.x265-SESKAPILE F9.The.Fast.Saga.2021.DC.TRUEFRENCH.BDRip.x264-Ulysse F9.The.Fast.Saga.2021.DC.MULTi.TRUEFRENCH.1080p.BluRay.x264-Ulysse F9.The.Fast.Saga.2021.DC.TRUEFRENCH.720p.BluRay.x264-Ulysse Hitmans.Wifes.Bodyguard.2021.EXTENDED.TRUEFRENCH.720p.BluRay.x264-Ulysse Hitmans.Wifes.Bodyguard.2021.EXTENDED.TRUEFRENCH.BDRip.x264-Ulysse, Hitmans.Wifes.Bodyguard.2021.EXTENDED.MULTI.TRUEFRENCH.1080p.BluRay.x264-Ulysse, Spirit.Untamed.2021.TRUEFRENCH.BDRip.x264-Ulysse Spirit.Untamed.2021.TRUEFRENCH.720p.BluRay.x264-Ulysse Spirit.Untamed.2021.MULTI.TRUEFRENCH.1080p.BluRay.x264-Ulysse Space.Jam.A.New.Legacy.2021.MULTI.TRUEFRENCH.2160p.UHD.BluRay.x265-SESKAPILE Space.Jam.A.New.Legacy2021.TRUEFRENCH.BDRip.x264-Ulysse Space.Jam.A.New.Legacy.2021.MULTi.TRUEFRENCH.1080p.BluRay.x264-Ulysse Space.Jam.A.New.Legacy.2021.TRUEFRENCH.720p.BluRay.x264-Ulysse //Match without YEAR but with edition Der.Movie.Eine.Unerwartete.Reise.Extended.German.720p.BluRay.x264-EXQUiSiTE Die.Unfassbaren.Movie.Name.EXTENDED.German.DTS.720p.BluRay.x264-RHD Die Unfassbaren Movie Name EXTENDED German DTS 720p BluRay x264-RHD Das.A.Team.Der.Film.Extended.Cut.German.720p.BluRay.x264-ANCIENT //Match without YEAR Movie.Weg.des.Kriegers.German.720p.BluRay.x264-EXQUiSiTE Movie.Weg.des.Kriegers.German.Extended.720p.BluRay.x264-EXQUiSiTE //Match when followed by edition Passengers.German.DL.AC3.Dubbed..BluRay.x264-PsO Cars.2.German.DL.720p.BluRay.x264-EmpireHD The.German.GERMAN.720p.BluRay.x264-UNiVERSUM Cars.2.german.CAM.720p.BluRay.x264-EmpireHD Appaloosa.TRUEFRENCH.DVDRiP.XViD-UNSKiLLED Arthur.Weihnachtsmann.German.DL.1080p.BluRay.x264-SONS Arthur.Weihnachtsmann.German.AC3.BDRiP.XViD-SONS The.German.Cam.German.720p.HDTV.x264-TVP //Match with YEAR The.Good.German.German.2006.DVDRiP.SVCD-ATS Herman.the.German.GERMAN.2019.720p.BluRay.x264-UNiVERSUM Der.Film.deines.Lebens.German.2011.PAL.DVDR-ETM Joe.Bell.German.2020.AC3.BDRiP.x264-ROCKEFELLER The.CaM.MAN.German.2006.720p.HDTV.x264-TVP The.German.Cam.German.2006.720p.HDTV.x264-TVP The.Good.German.German.2006.DVDRiP.SVCD-ATS //TODO It should match the year here Deadlock.German.2021.AC3.BDRiP.x264-ROCKEFELLER //TEST TRUEFRENCH 10x10.2018.MULTi.TRUEFRENCH.1080p.BluRay.x264-LOST 10x10.2018.TRUEFRENCH.720p.BluRay.x264-LOST 10x10.2018.TRUEFRENCH.BDRip.x264-PRiDEHD 12.Rounds.2009.MULTi.WiTH.TRUEFRENCH.1080p.BluRay.x264-MUxHD 12.Rounds.2009.TRUEFRENCH.720p.BluRay.x264-MUxHD 12.Rounds.TRUEFRENCH.DVDRip.XviD-REVOLTE 12.Years.a.Slave.2013.MULTi.TRUEFRENCH.1080p.BluRay.x264-FiDELiO 12.Years.a.Slave.2013.TRUEFRENCH.720p.BluRay.x264-FiDELiO 12.Years.a.Slave.2013.TRUEFRENCH.BDRip.x264-LOFiDEL 127.Hours.MULTi.WiTH.TRUEFRENCH.1080p.BluRay.x264.DTS-LOST 127.Hours.TRUEFRENCH.720p.BluRay.x264.DTS-LOST 127.Hours.TRUEFRENCH.BDRip.XviD-AYMO A.Christmas.Carol.TRUEFRENCH.DVDRip.XviD-REVOLTE Angels.And.Demons.EXTENDED.TRUEFRENCH.720p.BluRay.x264.DTS-UKDHD Appaloosa.TRUEFRENCH.DVDRiP.XViD-UNSKiLLED Arthur.Et.La.Vengeance.De.Maltazard.DVDRiP.TRUEFRENCH.XViD-FUCK Astro.Boy.TRUEFRENCH.DVDRip.XviD-AYMO Australia.TRUEFRENCH.DVDRip.XviD-UNSKiLLED Black.Swan.DiRFiX.TRUEFRENCH.720p.BluRay.x264.DTS-LOST //SHOULD NOT MATCH Its.a.German.Bluray.2013.AC3.DVDRiP.x264-ETM //This should not match when scene word is followed after a year Its.a.German.Cam.girl.2013.AC3.DVDRiP.x264-ETM //This should not match when scene word is followed after a year The.German.Cam.2012.720p.HDTV.x264-TVP The.German.2012.720p.HDTV.x264-TVP German.Song.2019.GERMAN.720p.BluRay.x264-UNiVERSUM German.Lancers.2019.GERMAN.720p.BluRay.x264-UNiVERSUM German.Lancers.2019.720p.BluRay.x264-UNiVERSUM German.Lancers.720p.BluRay.x264-UNiVERSUM German.Lessons.2019.GERMAN.720p.BluRay.x264-UNiVERSUM German.Fighters.2019.GERMAN.720p.BluRay.x264-UNiVERSUM German.Fried.Movie.2019.GERMAN.720p.BluRay.x264-UNiVERSUM My.German.Boyfriend.2019.GERMAN.720p.BluRay.x264-UNiVERSUM German.Grusel.-.Die.Edgar.Wallace-Serie.2019.GERMAN.720p.BluRay.x264-UNiVERSUM German.Jets.and.Destroyers.2019.GERMAN.720p.BluRay.x264-UNiVERSUM Tülay.German:.Kor.ve.Ateş.Yılları.2019.GERMAN.720p.BluRay.x264-UNiVERSUM The.German.Doctor.2019.GERMAN.720p.BluRay.x264-UNiVERSUM Movie.Squad.2016.EXTENDED.German.DL.AC3.BDRip.x264-hqc //Should not match Movie.and.Movie.2010.Extended.Cut.German.DTS.DL.720p.BluRay.x264-HDS //Should not match Gaia.Gruene.Hoelle.2021.German.DL.1080p.BluRay.AVC-UNTAVC //Should not match Gaia.Gruene.Hoelle.German.2021.German.DL.1080p.BluRay.AVC-UNTAVC //Should not match Movie.Klasse.von.1999.1990.German.720p.HDTV.x264-NORETAiL La.French.2014.PL.iNT.DVDRiP.x264-N0L La.French.2014.FRENCH.DVDRip.x264-PHoQUE La.French.2014.PAL.FRENCH.DVDR-Ryotox The.Good.German.2006.GERMAN.720p.HDTV.x264-TVP Wakolda.German.Subbed.2013.AC3.DVDRiP.x264-ETM //TODO This is bullshit with subbed, don't bother The.German.Doctor.2013.LIMITED.DVDRip.x264-RedBlade The.Good.German.2019.GERMAN.720p.BluRay.x264-UNiVERSUM The.Good.German.2019.720p.BluRay.x264-UNiVERSUM Herman.the.German.2019.GERMAN.720p.BluRay.x264-UNiVERSUM Herman.the.German.2019.720p.BluRay.x264-UNiVERSUM Aleksei.German.2019.GERMAN.720p.BluRay.x264-UNiVERSUM Aleksei.German.2019.720p.BluRay.x264-UNiVERSUM The.German.2019.GERMAN.720p.BluRay.x264-UNiVERSUM The.German.2019.720p.BluRay.x264-UNiVERSUM Der.Movie.Eine.Unerwartete.Reise.Extended.2020.German.720p.BluRay.x264-EXQUiSiTE //should not parse The.Good.German.-.In.den.Ruinen.von.Berlin.2019.GERMAN.720p.BluRay.x264-UNiVERSUM "; // 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/