Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • 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

/
/
gm

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)^\<(?<pri>[0-9]{1,5})\>1 (?<time>[^ ]+) (?<host>[^ ]+) (?<ident>[^ ]+) (?<pid>[-0-9]+) (?<msgid>[^ ]+) (?<extradata>(\[(.*?)\]|-)) (?<message>.+)$").unwrap(); let string = "<155>3 2024-02-08T14:54:57.472Z internationalcompelling.net sit 3790 ID900 - The GB driver is down, back up the virtual port so we can hack the SSL matrix! <141>2 2024-02-08T14:54:57.472Z dynamicproactive.biz optio 5167 ID22 - Transmitting the firewall won't do anything, we need to compress the redundant SMTP card! <141>3 2024-02-08T14:54:57.472Z leadinnovative.info et 1082 ID592 - I'Ll calculate the optical PNG transmitter, that should monitor the PCI microchip! <123>2 2024-02-08T14:54:57.472Z seniordeliverables.biz expedita 618 ID200 - Indexing the system won't do anything, we need to generate the open-source XSS port! <168>2 2024-02-08T14:54:57.472Z legacycompelling.biz qui 7207 ID561 - Parsing the matrix won't do anything, we need to parse the solid state RAM hard drive! <49>3 2024-02-08T14:54:57.472Z leadaction-items.com molestiae 3396 ID80 - The CSS matrix is down, back up the online firewall so we can transmit the PCI application! <25>2 2024-02-08T14:54:57.472Z directdeliver.org optio 2787 ID178 - Try to index the SMS pixel, maybe it will reboot the back-end card! <1>1 2024-02-08T14:54:57.472Z leadvalue-added.info incidunt 2214 ID227 - We need to quantify the online COM pixel! <160>1 2024-02-08T14:54:57.472Z legacycollaborative.net esse 9824 ID760 - Use the online AGP card, then you can index the primary interface! <17>1 2024-02-08T14:54:57.472Z directcontent.org numquam 7925 ID333 - We need to generate the back-end FTP protocol! <100>1 2024-02-08T14:54:57.472Z internalmetrics.biz quisquam 851 ID895 - You can't compress the firewall without backing up the neural SDD transmitter! <144>3 2024-02-08T14:54:57.472Z productincubate.com voluptas 5587 ID783 - Try to index the SCSI feed, maybe it will copy the virtual pixel! <66>3 2024-02-08T14:54:57.472Z internationalfacilitate.io repellendus 1939 ID707 - Try to compress the THX driver, maybe it will generate the multi-byte hard drive! <107>1 2024-02-08T14:54:57.472Z centralenable.biz eaque 1299 ID27 - I'Ll input the cross-platform HTTP system, that should capacitor the RSS program! <65>3 2024-02-08T14:54:57.472Z globalcollaborative.info ea 8131 ID307 - You can't copy the system without navigating the neural XSS card! <136>1 2024-02-08T14:54:57.472Z regionalviral.org corrupti 6515 ID413 - We need to bypass the haptic THX feed! <22>3 2024-02-08T14:54:57.472Z dynamice-commerce.net corrupti 2244 ID703 - Use the neural AGP application, then you can bypass the solid state pixel! <120>2 2024-02-08T14:54:57.472Z futureportals.org repellat 9197 ID527 - I'Ll calculate the optical SMS bandwidth, that should monitor the SMTP system! <77>1 2024-02-08T14:54:57.472Z leadend-to-end.com et 1159 ID766 - We need to hack the solid state HTTP program! <59>1 2024-02-08T14:54:57.472Z chiefgrow.name facere 9218 ID361 - You can't transmit the panel without hacking the back-end SCSI port! <106>1 2024-02-08T14:54:57.472Z futurecultivate.org neque 6183 ID204 - Synthesizing the protocol won't do anything, we need to input the cross-platform HTTP system! <173>2 2024-02-08T14:54:57.472Z productbest-of-breed.name aut 661 ID206 - You can't hack the microchip without bypassing the open-source SAS card! <124>2 2024-02-08T14:54:57.472Z corporatecutting-edge.com aut 4224 ID630 - We need to generate the neural HDD matrix! <182>2 2024-02-08T14:54:57.472Z regionalmethodologies.biz deleniti 70 ID222 - You can't generate the pixel without compressing the wireless RSS capacitor! <180>3 2024-02-08T14:54:57.472Z customermethodologies.com nihil 8304 ID777 - The IB application is down, synthesize the neural driver so we can bypass the AGP bus! <191>2 2024-02-08T14:54:57.472Z legacytransparent.org porro 5419 ID481 - Try to calculate the AI driver, maybe it will override the auxiliary transmitter! <75>3 2024-02-08T14:54:57.472Z districtdynamic.biz distinctio 9585 ID288 - Programming the program won't do anything, we need to reboot the wireless JBOD matrix! <81>2 2024-02-08T14:54:57.472Z globaluser-centric.com aspernatur 6780 ID346 - We need to override the auxiliary SDD port! <38>2 2024-02-08T14:54:57.472Z investorempower.biz ducimus 7327 ID810 - We need to input the redundant USB hard drive! <182>1 2024-02-08T14:54:57.472Z regionalviral.name deserunt 2782 ID680 - Use the open-source SDD card, then you can compress the virtual pixel! <87>3 2024-02-08T14:54:57.472Z corporaterevolutionary.org error 128 ID157 - I'Ll program the wireless SAS microchip, that should driver the JBOD pixel! <17>2 2024-02-08T14:54:57.472Z productengineer.io enim 4328 ID459 - Use the digital ADP port, then you can copy the bluetooth capacitor! <141>2 2024-02-08T14:54:57.472Z principalone-to-one.io dolore 7459 ID99 - If we navigate the panel, we can get to the RAM capacitor through the digital SQL port! <44>1 2024-02-08T14:54:57.472Z productarchitect.com vel 2535 ID158 - The COM interface is down, hack the online feed so we can reboot the SMTP monitor! <9>2 2024-02-08T14:54:57.472Z directextensible.io enim 1617 ID522 - Backing up the bandwidth won't do anything, we need to transmit the mobile USB bus! <170>3 2024-02-08T14:54:57.472Z regionalcross-platform.com et 2335 ID658 - Backing up the bandwidth won't do anything, we need to synthesize the digital PNG card! <42>1 2024-02-08T14:54:57.472Z investortransparent.org et 397 ID828 - Generating the alarm won't do anything, we need to reboot the auxiliary THX application! <87>1 2024-02-08T14:54:57.472Z dynamictransform.io nemo 5657 ID145 - Use the multi-byte GB application, then you can calculate the mobile protocol! <77>3 2024-02-08T14:54:57.472Z nationalengineer.com aut 6834 ID742 - Use the bluetooth JBOD port, then you can compress the open-source bus! <121>1 2024-02-08T14:54:57.472Z humanholistic.net culpa 1540 ID346 - Use the primary FTP alarm, then you can navigate the optical alarm! <44>1 2024-02-08T14:54:57.472Z corporateopen-source.biz nobis 8057 ID540 - You can't copy the card without navigating the digital SSL circuit! <27>2 2024-02-08T14:54:57.472Z corporateextend.net et 9797 ID36 - Overriding the feed won't do anything, we need to parse the online AGP microchip! <40>1 2024-02-08T14:54:57.472Z globalrecontextualize.biz error 3458 ID535 - If we program the feed, we can get to the THX feed through the redundant XSS sensor! <94>2 2024-02-08T14:54:57.472Z internationalinfomediaries.org at 2508 ID719 - Compressing the capacitor won't do anything, we need to compress the solid state RSS capacitor! <176>1 2024-02-08T14:54:57.472Z futuree-commerce.biz aperiam 323 ID888 - The SCSI matrix is down, override the haptic card so we can quantify the TCP pixel! <137>3 2024-02-08T14:54:57.472Z internalstrategic.net molestiae 3739 ID112 - You can't back up the driver without generating the neural SMS feed! <178>1 2024-02-08T14:54:57.472Z forwardschemas.com id 5670 ID663 - Try to navigate the RAM array, maybe it will reboot the redundant driver! <172>3 2024-02-08T14:54:57.472Z humanmonetize.net quis 3944 ID562 - We need to copy the back-end USB bandwidth! <26>3 2024-02-08T14:54:57.472Z internationalevolve.biz est 5175 ID850 - Overriding the circuit won't do anything, we need to back up the optical JBOD matrix! <50>3 2024-02-08T14:54:57.472Z internationalmorph.net nihil 6779 ID5 - You can't input the alarm without connecting the redundant HTTP alarm! <94>1 2024-02-08T14:54:57.472Z productweb-readiness.info provident 5143 ID59 - If we input the alarm, we can get to the HDD bandwidth through the virtual RSS system! <129>1 2024-02-08T14:54:57.472Z dynamicbleeding-edge.info repellendus 3033 ID263 - Try to synthesize the TCP bandwidth, maybe it will bypass the 1080p capacitor! <100>1 2024-02-08T14:54:57.472Z corporatesynergistic.com nam 6469 ID331 - Quantifying the capacitor won't do anything, we need to program the virtual RAM program! <14>2 2024-02-08T14:54:57.472Z customerenvisioneer.info et 8703 ID10 - We need to hack the primary USB circuit! <180>1 2024-02-08T14:54:57.472Z principalstrategize.biz illum 6334 ID811 - I'Ll generate the cross-platform PNG bus, that should driver the THX bandwidth! <71>1 2024-02-08T14:54:57.472Z customerdeploy.net alias 50 ID662 - I'Ll connect the redundant COM driver, that should matrix the SSL bus! <126>3 2024-02-08T14:54:57.472Z productembrace.name beatae 3008 ID924 - The COM application is down, calculate the wireless matrix so we can compress the COM monitor! <186>1 2024-02-08T14:54:57.472Z dynamicreintermediate.net sunt 740 ID600 - Try to calculate the ADP array, maybe it will index the neural firewall! <15>3 2024-02-08T14:54:57.472Z customeraction-items.com voluptatem 5525 ID626 - Try to bypass the RAM system, maybe it will override the cross-platform application! <68>3 2024-02-08T14:54:57.472Z internalturn-key.io architecto 4981 ID154 - I'Ll back up the redundant SDD system, that should driver the JSON circuit! <70>1 2024-02-08T14:54:57.472Z forwardsticky.io omnis 750 ID922 - I'Ll input the mobile GB bus, that should protocol the JBOD matrix! <33>2 2024-02-08T14:54:57.472Z nationalvirtual.net ratione 5079 ID290 - Use the wireless XML monitor, then you can input the cross-platform microchip! <130>2 2024-02-08T14:54:57.472Z senioropen-source.name ut 1630 ID246 - Use the neural EXE transmitter, then you can transmit the mobile microchip! <2>1 2024-02-08T14:54:57.472Z productsyndicate.net molestiae 1313 ID427 - Quantifying the bus won't do anything, we need to parse the wireless RSS microchip! <124>3 2024-02-08T14:54:57.472Z chiefscale.io in 798 ID413 - Use the bluetooth PCI microchip, then you can compress the online hard drive! <144>3 2024-02-08T14:54:57.472Z centralfacilitate.io adipisci 4845 ID981 - We need to synthesize the 1080p SCSI panel! <189>1 2024-02-08T14:54:57.472Z seniorcultivate.org exercitationem 1134 ID620 - Try to reboot the PCI sensor, maybe it will transmit the wireless panel! <30>1 2024-02-08T14:54:57.472Z globalintegrate.io optio 8658 ID727 - The SCSI monitor is down, quantify the bluetooth bandwidth so we can synthesize the SCSI interface! <72>1 2024-02-08T14:54:57.472Z forwardwhiteboard.net aliquid 810 ID355 - Use the digital PCI hard drive, then you can generate the multi-byte matrix! <141>2 2024-02-08T14:54:57.472Z investorsynergize.info debitis 4711 ID933 - You can't connect the firewall without backing up the bluetooth SSL system! <57>1 2024-02-08T14:54:57.472Z humanout-of-the-box.org vel 4503 ID998 - I'Ll override the multi-byte XSS pixel, that should pixel the COM array! <171>3 2024-02-08T14:54:57.472Z chiefdeploy.net quidem 1315 ID267 - You can't back up the application without quantifying the neural SSL microchip! <94>3 2024-02-08T14:54:57.472Z regionalleading-edge.com rerum 9033 ID869 - I'Ll transmit the cross-platform RAM circuit, that should protocol the SAS hard drive! <77>3 2024-02-08T14:54:57.472Z internalniches.biz necessitatibus 4252 ID349 - Compressing the driver won't do anything, we need to index the solid state IB matrix! <116>2 2024-02-08T14:54:57.472Z chiefmarkets.com earum 5172 ID417 - Synthesizing the hard drive won't do anything, we need to compress the primary RAM hard drive! <15>3 2024-02-08T14:54:57.472Z dynamicinnovative.net aut 3257 ID257 - If we connect the panel, we can get to the PNG port through the bluetooth TCP driver! <133>1 2024-02-08T14:54:57.472Z nationale-tailers.org sunt 7321 ID692 - Use the 1080p JSON transmitter, then you can compress the multi-byte matrix! <74>1 2024-02-08T14:54:57.472Z dynamicstrategic.biz blanditiis 6556 ID104 - Use the mobile TCP system, then you can generate the cross-platform application! <12>2 2024-02-08T14:54:57.472Z humanunleash.biz eum 4214 ID436 - I'Ll copy the online SDD circuit, that should microchip the SCSI array! <30>2 2024-02-08T14:54:57.472Z regionaltechnologies.io iure 1953 ID56 - Compressing the driver won't do anything, we need to transmit the optical HDD protocol! <127>2 2024-02-08T14:54:57.472Z principalarchitectures.org et 8459 ID53 - I'Ll hack the bluetooth XML array, that should driver the PNG transmitter! <170>3 2024-02-08T14:54:57.472Z humanembrace.com eligendi 1256 ID325 - You can't index the panel without overriding the mobile SSL panel! <110>3 2024-02-08T14:54:57.472Z forwarddynamic.org libero 8534 ID82 - Use the solid state HDD bus, then you can override the auxiliary bus! <142>3 2024-02-08T14:54:57.472Z centralglobal.info magni 8175 ID155 - Use the bluetooth XSS bus, then you can generate the redundant transmitter! <122>1 2024-02-08T14:54:57.472Z dynamicglobal.info et 804 ID187 - The FTP bandwidth is down, override the digital matrix so we can copy the EXE program! <143>3 2024-02-08T14:54:57.472Z customerplatforms.info deserunt 7430 ID164 - We need to synthesize the haptic IB sensor! <180>2 2024-02-08T14:54:57.472Z senior24/7.name qui 1332 ID982 - The HTTP matrix is down, generate the primary circuit so we can override the THX card! <177>3 2024-02-08T14:54:57.472Z seniorredefine.info et 3782 ID409 - We need to calculate the open-source THX capacitor! <1>3 2024-02-08T14:54:57.472Z centralmaximize.org perferendis 2028 ID657 - The AI feed is down, input the solid state matrix so we can synthesize the XSS circuit! <57>2 2024-02-08T14:54:57.472Z principalglobal.biz sunt 4085 ID808 - Use the cross-platform RAM matrix, then you can override the digital array! <34>3 2024-02-08T14:54:57.472Z directcompelling.org ex 9010 ID616 - Use the auxiliary SMS bandwidth, then you can generate the haptic array! <92>3 2024-02-08T14:54:57.472Z futureopen-source.info ut 1455 ID575 - We need to back up the wireless ADP application! <30>1 2024-02-08T14:54:57.472Z chiefholistic.org ex 3315 ID108 - The XSS microchip is down, compress the multi-byte transmitter so we can override the AI bus! <87>1 2024-02-08T14:54:57.472Z humanniches.biz praesentium 2518 ID612 - If we index the program, we can get to the SMTP feed through the redundant HTTP application! <165>3 2024-02-08T14:54:57.472Z futurecross-media.org voluptates 2429 ID190 - Use the primary PCI array, then you can synthesize the optical capacitor! <125>1 2024-02-08T14:54:57.472Z districtbest-of-breed.net minima 85 ID589 - The SCSI system is down, parse the back-end protocol so we can transmit the JSON capacitor! <106>2 2024-02-08T14:54:57.472Z regionalmaximize.net eos 8032 ID426 - Use the optical SCSI feed, then you can input the open-source application! <88>1 2024-02-08T14:54:57.472Z chiefengineer.biz optio 3406 ID993 - We need to override the virtual SMTP feed! <80>3 2024-02-08T14:54:57.472Z nationalengage.name doloribus 2894 ID845 - I'Ll transmit the multi-byte SMS hard drive, that should driver the CSS sensor! <158>2 2024-02-08T14:54:57.472Z customerincentivize.io accusamus 1382 ID199 - Try to bypass the RSS bus, maybe it will copy the 1080p protocol!"; // 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/