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
No Match

/
/
gm

Test String

Code Generator

Generated Code

const regex = /^.+[\n\r]+.+[\n\r]+/gm; // Alternative syntax using RegExp constructor // const regex = new RegExp('^.+[\\n\\r]+.+[\\n\\r]+', 'gm') const str = `Market:;XFRA Date Last Update:;23.04.2024 Product Status;Instrument Status;Instrument;ISIN;Product ID;Instrument ID;WKN;Mnemonic;MIC Code;CCP eligible Code;Trading Model Type;Product Assignment Group;Product Assignment Group Description;Designated Sponsor Member ID;Designated Sponsor;Price Range Value;Price Range Percentage;Minimum Quote Size;Instrument Type;Tick Size 1;Upper Price Limit Max;Tick Size 2;Upper Price Limit 2;Tick Size 3;Upper Price Limit 3;Tick Size 4;Upper Price Limit 4;Tick Size 5;Upper Price Limit 5;Tick Size 6;Upper Price Limit 6;Tick Size 7;Upper Price Limit 7;Tick Size 8;Upper Price Limit 8;Tick Size 9;Upper Price Limit 9;Tick Size 10;Upper Price Limit 10;Tick Size 11;Upper Price Limit 11;Tick Size 12;Upper Price Limit 12;Tick Size 13;Upper Price Limit 13;Tick Size 14;Upper Price Limit 14;Tick Size 15;Upper Price Limit 15;Tick Size 16;Upper Price Limit 16;Tick Size 17;Upper Price Limit 17;Tick Size 18;Upper Price Limit 18;Tick Size 19;Upper Price Limit 19;Tick Size 20;Upper Price Limit 20;Number of Decimal Digits;Unit of Quotation;Market Segment;Market Segment Supplement;Clearing Location;Primary Market MIC Code;Reporting Market;Settlement Period;Settlement Currency;Closed Book Indicator;Market Imbalance Indicator;CUM/EX Indicator;Minimum Iceberg Total Volume;Minimum Iceberg Display Volume;EMDI Incremental A - Unnetted;EMDI Incremental A - Unnetted Port;EMDI Incremental B - Unnetted;EMDI Incremental B - Unnetted Port;EMDI Snapshot A - Unnetted;EMDI Snapshot A - Unnetted Port;EMDI Snapshot B - Unnetted;EMDI Snapshot B - Unnetted Port;EMDI Market Depth - Unnetted;EMDI Snapshot Recovery Time Interval - Unnetted;MDI Address A - Netted;MDI Port A - Netted;MDI Address B - Netted;MDI Port B - Netted;MDI Market Depth - Netted;MDI Market Depth Time Interval - Netted;MDI Recovery Time Interval - Netted;EOBI Incremental A;EOBI Incremental Port A;EOBI Incremental B;EOBI Incremental Port B;EOBI Snapshot A;EOBI Snapshot Port A;EOBI Snapshot B;EOBI Snapshot Port B;Market Maker Member ID;Market Maker;Regulatory Liquid Instrument;Pre-trade LIS Value;Partition ID;Multi CCP-eligible;Tick Size Band;Security Sub Type;Issue Date;Underlying;Maturity Date;Flat Indicator;Coupon Rate;Previous Coupon Payment Date;Next Coupon Payment Date;Pool Factor;Indexation Coefficient;Accrued Interest Calculation Method;Country Of Issue;Minimum Tradable Unit;In-Subscription;Strike Price;Minimum Order Quantity;Off-Book Reporting Market;Instrument Auction Type;Specialist Member ID;Specialist;Liquidity Provider User Group;Specialist User Group;Quoting Period Start;Quoting Period End;Currency;Warrant Type;First Trading Date;Last Trading Date;Deposit Type;Single Sided Quote Support;Liquidity Class;Cover Indicator;VolatilityCorridorOpeningAuction;VolatilityCorridorIntradayAuction;VolatilityCorridorClosingAuction;VolatilityCorridorContinuous;DisableOnBookTrading Active;Active;RAIF.BK INT. 18/25FLR MTN;AT000B014345;13;10583;000A1915H;;XFRA;N;ContinuousAuctionSpecialist;PAG_BON;BOERSE FRANKFURT BONDS;;;;;1;BOND;0.001;9999999999.9999;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5;Percent;085;;BOFRA;WBAH;FRAB;2;EUR;1;0;;;;224.0.160.109;56001;224.0.162.109;56001;224.0.160.108;56000;224.0.162.108;56000;1;500000;224.0.161.46;56000;224.0.163.46;56000;1;3500;300000;224.0.160.237;56001;224.0.162.237;56001;224.0.160.236;56000;224.0.162.236;56000;BALFR;BAADER BANK AG;N;1500000.00000000;2;N;PST_BF2;;2018-06-25;;2025-06-25;1;2.5;2024-03-25;2024-06-25;1.000000000;1.0000000;6;;100000;N;;100000;FRAV;SingleAuction;BALFR;BAADER BANK AG;QPF;VRR;11:00:00;13:00:00;EUR;;2018-07-23;2025-06-20;GIROSAMMELVERWAHRUNG;SSQ_SUPPORTED;;;;;;;N`; // Reset `lastIndex` if this regex is defined globally // regex.lastIndex = 0; let m; while ((m = regex.exec(str)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regex.lastIndex) { regex.lastIndex++; } // The result can be accessed through the `m`-variable. m.forEach((match, groupIndex) => { console.log(`Found match, group ${groupIndex}: ${match}`); }); }

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 JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions