Regular Expressions 101

Save & Share

  • Regex Version: ver. 23
  • 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 = /(^Order No.*|^EAN.*|Customer Material.*)\n\s*(\d+) [\s\S\n]+?(?=(EAN: \d+))/gm; // Alternative syntax using RegExp constructor // const regex = new RegExp('(^Order No.*|^EAN.*|Customer Material.*)\\n\\s*(\\d+) [\\s\\S\\n]+?(?=(EAN: \\d+))', 'gm') const str = `Vorsitzender des Aufsichtsrats/Chairman of the Supervisory Board: Dr. Heinrich Hiesinger Commerzbank AG, Schweinfurt Vorstand/Board of Management: Dr. Holger Klein (Vorsitzender/CEO), Dr. Martin Fischer, Kto. 653 3277 Michael Frick, Dr. Lea Corzilius, Dr. Peter Laier, Stephan von Schuckmann SWIFT:COBADEFF793 Sitz/Headquarters: Friedrichshafen # Handelsregistereintrag Amtsgericht Ulm HRB 630206/ IBAN-No:DE82793400540653327700 Trade register of the municipal court of Ulm HRB 630206 www.Giovanni .com Our VAT No. DE145374190 1/7 Giovanni AG Giovanni Aftermarket,Obere Weiden 12,97424 Schweinfurt Carmelo Srl EOO Via del molino 26 2024 Praga Spanish Invoice Please state with payment Number 5013018456 Transport 101131778 Contact person Lenka Bocek E-Mail lenka.bocek@Giovanni .com Customer No/Supplier D068110/885522 Date 14.02.2024 Telephone 00420 731316628 Your VAT No. BG175423111 Terms of delivery: DAP Praga subject to Incoterms 2020 Goods recipient Carmelo Srl EOO Via del molino 26 2024 Praga Spanish Shipment by Truck - normal Forwarder Lagermax Logistics Austria GmbH Item Part Number Description Suffix Quantity Piece Price/ EUR Per PCE Disc.% Amount EUR Customer Material / Material entered / OE-Number Transport: 23960099 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3161493 Your Reference: A202311161157 202 1327.302.005 000 1 176,01 1 176,01 HELICAL GEAR HS.code: 87084099 Country of origin: EU/DE EAN: 2050000169496 Goods value: 176,01 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3172200 Your Reference: A202312071323 212 0630.502.009 000 30 0,21 1 6,30 CIRCLIP HS.code: 73182100 Country of origin: QU EAN: 2050000290305 222 0630.502.009 000 100 0,21 1 21,00 CIRCLIP HS.code: 73182100 Country of origin: TR EAN: 2050000290305 Goods value: 27,30 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3188921 Your Reference: A202401171435 952 4181.355.025 000 1 11,58 1 11,58 END DISC HS.code: 87084099 Country of origin: EU/PL EAN: 2050000114007 Goods value: 11,58 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3188973 Your Reference: A202401171606 carry forward 214,89 2/7 Giovanni AG Giovanni Aftermarket,Obere Weiden 12,97424 Schweinfurt Carmelo Srl EOO Via del molino 26 2024 Praga Spanish Number 5013018456 Date 14.02.2024 carry forward 214,89 Item Part Number Description Suffix Quantity Piece Price/ EUR Per PCE Disc.% Amount EUR Customer Material / Material entered / OE-Number 962 1328.298.005 009 2 323,25 1 646,50 CLUTCH ACTUATOR HS.code: 87084099 Country of origin: EU/CZ EAN: 4053202141381 Goods value: 646,50 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3189396 Your Reference: A202401181248 972 0750.116.607 000 3 26,43 1 79,29 BALL BEARING HS.code: 84821090 Country of origin: IN EAN: 2050013015506 982 1307.203.019 009 1 16,31 1 16,31 TA.ROLLER BEARING HS.code: 84822000 Country of origin: JP EAN: 4053202051758 992 4139.298.081 009 2 172,30 1 344,60 SEALING RING KIT HS.code: 84849000 Country of origin: EU/DE EAN: 4053202129518 1002 4181.377.018 000 1 14,45 1 14,45 SCREW PLUG HS.code: 73181595 Country of origin: EU/DE EAN: 2050000154355 Goods value: 454,65 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3193183 Your Reference: A202401251225 1012 4181.377.050 000 2 277,57 1 555,14 OIL PAN HS.code: 87084099 Country of origin: TR EAN: 2050011039825 Goods value: 555,14 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3193355 Your Reference: A202401251529 1022 1315.315.012 000 2 4,50 1 9,00 GASKET HS.code: 84841000 Country of origin: EU/DE EAN: 2050000167836 1032 4139.298.942 009 3 177,38 1 532,14 SEALING RING KIT HS.code: 84849000 Country of origin: EU/DE EAN: 4053202129433 1042 4149.320.033 000 1 97,71 1 97,71 SEALING WASHER HS.code: 87084099 Country of origin: EU/DE EAN: 2050000061196 1052 0501.332.745 000 2 9,32 1 18,64 SLIDING BUSH HS.code: 87085091 Country of origin: EU/DE EAN: 2050009868260 Goods value: 657,49 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3197043 Your Reference: A202402011151 carry forward 2.528,67 3/7 Giovanni AG Giovanni Aftermarket,Obere Weiden 12,97424 Schweinfurt Carmelo Srl EOO Via del molino 26 2024 Praga Spanish Number 5013018456 Date 14.02.2024 carry forward 2.528,67 Item Part Number Description Suffix Quantity Piece Price/ EUR Per PCE Disc.% Amount EUR Customer Material / Material entered / OE-Number 1062 0636.015.270 000 1 0,48 1 0,48 HEXAGON SCREW HS.code: 73181582 Country of origin: EU/IT EAN: 2050000159053 1072 0735.358.321 000 12 20,71 1 248,52 NEEDLE CAGE HS.code: 84824000 Country of origin: EU/SK EAN: 2050000158612 1082 0501.320.369 000 5 15,75 1 78,75 SEALING RING HS.code: 39269097 Country of origin: EU/IE EAN: 2050000018428 Goods value: 327,75 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3197919 Your Reference: A202402021508 1092 0501.314.432 000 10 17,91 1 179,10 IND.TRANSMITTER HS.code: 90299000 Country of origin: TR EAN: 2050000077111 1102 0501.316.322 000 11 16,10 1 177,10 GASKET HS.code: 84841000 Country of origin: GB EAN: 2050000014130 1112 0501.316.527 000 7 70,00 1 490,00 SOLENOID VALVE HS.code: 84818079 Country of origin: EU/CZ EAN: 2050000011412 1122 0501.319.200 009 20 109,68 1 2.193,60 SOLENOID VALVE HS.code: 84818079 Country of origin: CH EAN: 4053202026244 1132 0501.322.776 000 10 10,44 1 104,40 GASKET HS.code: 84841000 Country of origin: EU/DE EAN: 2050003241472 1142 0501.324.367 000 10 10,04 1 100,40 FLAT GASKET HS.code: 84841000 Country of origin: EU/DE EAN: 2050000036156 1152 0501.324.368 000 10 10,14 1 101,40 FLAT GASKET HS.code: 84841000 Country of origin: EU/DE EAN: 2050000116957 1162 0631.329.051 000 50 0,27 1 13,50 SPRING PIN HS.code: 73269098 Country of origin: EU/DE EAN: 2050000004667 1172 0631.329.167 000 50 0,18 1 9,00 SPRING PIN HS.code: 73269098 Country of origin: EU/DE EAN: 2050000065132 1182 0634.349.843 000 19 3,52 1 66,88 O-RING HS.code: 39269097 Country of origin: EU/IT EAN: 2050003379939 1192 0730.007.488 000 1 14,10 1 14,10 SHIM HS.code: 73182200 Country of origin: EU/DE EAN: 2050000078606 carry forward 6.305,90 4/7 Giovanni AG Giovanni Aftermarket,Obere Weiden 12,97424 Schweinfurt Carmelo Srl EOO Via del molino 26 2024 Praga Spanish Number 5013018456 Date 14.02.2024 carry forward 6.305,90 Item Part Number Description Suffix Quantity Piece Price/ EUR Per PCE Disc.% Amount EUR Customer Material / Material entered / OE-Number 1202 0730.008.528 000 5 14,37 1 71,85 SHIM HS.code: 73182200 Country of origin: EU/DE EAN: 2050000120220 1212 0730.106.860 000 1 14,80 1 14,80 SHIM HS.code: 73182200 Country of origin: EU/SK EAN: 2050000014468 1222 0730.106.917 000 4 11,36 1 45,44 SHIM HS.code: 73182200 Country of origin: EU/SK EAN: 2050000119125 1232 0730.110.828 000 3 8,75 1 26,25 SPACER WASHER HS.code: 73182200 Country of origin: EU/DE EAN: 2050000046438 1242 0730.514.009 000 10 5,27 1 52,70 SNAP RING HS.code: 73182100 Country of origin: EU/IT EAN: 2050000094248 1252 0732.040.929 000 30 0,39 1 11,70 COMPR.SPRING HS.code: 73202081 Country of origin: EU/DE EAN: 2050000113284 1262 0734.401.251 000 44 3,05 1 134,20 PISTON RING HS.code: 73182100 Country of origin: JP EAN: 2050000026638 1272 0735.298.169 000 11 18,50 1 203,50 AXIAL NEEDLE BEARING HS.code: 84824000 Country of origin: EU/DE EAN: 2050000114557 1282 0735.301.275 000 8 5,62 1 44,96 NEEDLE CAGE HS.code: 84824000 Country of origin: EU/DE EAN: 2050003165266 1292 0750.115.303 000 1 18,95 1 18,95 NEEDLE CAGE HS.code: 84824000 Country of origin: IN EAN: 2050000116407 1302 0750.115.518 000 10 2,16 1 21,60 NEEDLE SLEEVE HS.code: 84824000 Country of origin: EU/DE EAN: 2050000086328 1312 0750.115.519 000 5 4,06 1 20,30 NEEDLE SLEEVE HS.code: 84824000 Country of origin: US EAN: 2050000080418 1322 0750.116.266 000 6 14,48 1 86,88 BALL BEARING HS.code: 84821010 Country of origin: JP EAN: 2050000136542 1332 0750.116.365 000 10 26,91 1 269,10 BALL BEARING HS.code: 84821090 Country of origin: CN EAN: 2050000117732 carry forward 7.328,13 5/7 Giovanni AG Giovanni Aftermarket,Obere Weiden 12,97424 Schweinfurt Carmelo Srl EOO Via del molino 26 2024 Praga Spanish Number 5013018456 Date 14.02.2024 carry forward 7.328,13 Item Part Number Description Suffix Quantity Piece Price/ EUR Per PCE Disc.% Amount EUR Customer Material / Material entered / OE-Number 1342 0750.118.284 000 1 86,07 1 86,07 NEEDLE BEARING HS.code: 84824000 Country of origin: IN EAN: 2050000044779 1352 0770.067.039 000 4 15,42 1 61,68 CUP SPRING HS.code: 73209030 Country of origin: EU/DE EAN: 2050003236652 1362 1296.333.050 000 5 70,20 1 351,00 CLUTCH BODY HS.code: 87084099 Country of origin: CN EAN: 2050000147401 1372 1312.304.056 000 5 58,26 1 291,30 CLUTCH BODY HS.code: 87084099 Country of origin: EU/DE EAN: 2050000035371 1382 1315.334.069 000 10 26,87 1 268,70 CYLINDER HS.code: 87084099 Country of origin: EU/DE EAN: 2050000084003 1392 1316.233.030 000 1 224,45 1 224,45 CLUTCH BODY HS.code: 87084099 Country of origin: EU/DE EAN: 2050000093555 1402 1316.302.066 000 1 137,24 1 137,24 HELICAL GEAR HS.code: 87084099 Country of origin: EU/DE EAN: 2050000087578 1412 1316.304.189 000 2 56,43 1 112,86 SYNCHRO.RING HS.code: 87084099 Country of origin: QU EAN: 2050000074554 1422 1316.332.129 000 1 614,22 1 614,22 RING GEAR CARRIER HS.code: 87084099 Country of origin: EU/DE EAN: 2050013222829 1432 1324.207.033 000 34 5,12 1 174,08 DETENT PLUNGER HS.code: 73182900 Country of origin: EU/DE EAN: 2050000062810 1442 1327.304.015 000 9 449,65 1 4.046,85 HELICAL GEAR HS.code: 87084099 Country of origin: EU/IT EAN: 2050000156090 1452 1328.304.064 000 10 71,59 1 715,90 SLIDING SLEEVE HS.code: 87084099 Country of origin: EU/DE EAN: 2050000047541 1462 4139.206.415 000 36 13,42 1 483,12 PISTON HS.code: 87084099 Country of origin: EU/DE EAN: 2050000144929 1472 4139.298.021 009 7 34,75 1 243,25 REPAIR KIT HS.code: 87084099 Country of origin: EU/DE EAN: 4053202174013 carry forward 15.138,85 6/7 Giovanni AG Giovanni Aftermarket,Obere Weiden 12,97424 Schweinfurt Carmelo Srl EOO Via del molino 26 2024 Praga Spanish Number 5013018456 Date 14.02.2024 carry forward 15.138,85 Item Part Number Description Suffix Quantity Piece Price/ EUR Per PCE Disc.% Amount EUR Customer Material / Material entered / OE-Number 1482 4139.298.042 009 1 529,87 1 529,87 REPAIR KIT HS.code: 87084099 Country of origin: EU/PL EAN: 4053202173832 1492 4139.333.745 000 23 17,05 1 392,15 O.CLUTCH DISC HS.code: 87084099 Country of origin: EU/DE EAN: 2050000143649 1502 4139.333.765 000 12 6,72 1 80,64 I.CLUTCH DISC HS.code: 87084099 Country of origin: EU/DE EAN: 2050000136405 1512 4149.206.098 000 1 231,46 1 231,46 WIRING HARNESS HS.code: 85443000 Country of origin: EU/DE EAN: 2050000096723 1522 4149.310.025 000 3 37,78 1 113,34 PISTON HS.code: 87084099 Country of origin: EU/DE EAN: 2050000141478 1532 4181.298.004 009 15 805,25 1 12.078,75 REPAIR KIT HS.code: 87084099 Country of origin: EU/PL EAN: 4053202151564 1542 6093.201.055 000 5 8,98 1 44,90 PISTON HS.code: 87084099 Country of origin: EU/DE EAN: 2050013340097 1552 0730.306.436 000 100 1,97 1 197,00 TYPE PLATE HS.code: 83100000 Country of origin: EU/DE EAN: 2050014608639 Goods value: 25.950,54 Delivery: 165144875 Goods recipient: Carmelo Srl Date of del.: 14.02.2024 Order No.: 3198913 Your Reference: A202402051653 1562 0636.011.768 000 2.000 0,52 1 1.040,00 HEXAGON SCREW HS.code: 73181588 Country of origin: TR EAN: 2050000044588 1572 0636.024.526 000 1.000 0,79 1 790,00 HEXAGON SCREW HS.code: 73181588 Country of origin: TR EAN: 2050000110092 Goods value: 1.830,00 Freight charges 183,03 Subtotal 30.636,96 Freight charges 183,03 Total amount 30.819,99 Terms of payment Up to 28.02.2024 you receive 2,000 % discount Up to 14.04.2024 without deduction Tax free supply within the EEC in terms of §6a VAT Law. Packaging 2 collies Gross weight/kg 472,00 Net weight/kg 440,00 Marks: Carmelo Srl Sofia Bulgaria 7/7 Giovanni AG Giovanni Aftermarket,Obere Weiden 12,97424 Schweinfurt Carmelo Srl EOO Via del molino 26 2024 Praga Spanish Number 5013018456 Date 14.02.2024 0023960099/1 -2 All gross prices are the recommended retail prices. Place of fulfillment for delivery and payment is Schweinfurt. For all payments and enquiries, please indicate customer no., invoice no. and date. The terms of supply and payment can be found under www.aftermarket.Giovanni .com/tac. This document has been created automatically, therefore it is issued without signature and stamp. `; // 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