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

/
/
g

Test String

Substitution

Processing...

Code Generator

Generated Code

$re = '/(?m)^(\d{4}|\d{3} \d|\d \d{3}|\d{2} \d{2}) ([^ ]+) (.+?)(?:\s*\.\s)+0,00|^(\d{4}|\d{3} \d|\d \d{3}|\d{2} \d{2}) ([^ ]+) (.+?)(?:\s*)+0,00/'; $str = 'N° Référence Description Qté Commentaire 0110 481246218263 PIED REGLABLE. . . . . . . . . . 0,00 0400 481010619062 CHARNIERE SUP . . . . . . . . . 0,00 1 020 481010712494 PORTE CONGEL. SIX/MG 1832x590 m. 0,00 10 50 481010628165 BAGUE. . . . . . . . . . . . . . 0,00 10 51 481010643399 BUTEE DE PORTE right grey. . . . 0,00 105 2 481010643398 BUTEE DE PORTE left grey. . . . 0,00 1100 481010637390 POIGNEE. . . . . . . . . . . . . 0,00 1 117 481010465600 PLAQUE SIGLE WHIRLPOOL, 2012. . 0,00 1830 481010461413 TRAVERSE. . . . . . . . . . . . 0,00 185 1 481010443535 PIED arriere. . . . . . . . . . 0,00 1853 481010643504 COUVERCLE INFERIEUR CHARNIERE, G 0,00 1880 481010616667 CHARNIERE INF . . . . . . . . . 0,00 1888 481010616670 AXE CHARNIERE. . . . . . . . . . 0,00 1889 481010493638 AXE CHARNIERE. . . . . . . . . . 0,00 1911 481010627574 JOINT MAGNET. gris. . . . . . . 0,00 2010 481010709270 CAPOT ARRIERE BLANC UF60. . . . 0,00 2332 481010522421 SUPPORT BLANC 0,00 2333 481010529900 SUPPORT. . . . . . . . . . . . . 0,00 2334 481010529894 SUPPORT. . . . . . . . . . . . . 0,00 2335 481010529897 SUPPORT. . . . . . . . . . . . . 0,00 2336 481010529891 SUPPORT. . . . . . . . . . . . . 0,00 2393 481010522414 RESERVE A GLACONS BLANC. . . . . 0,00 2397 481010557586 RESERVE GLACONS ICE MATE. . . . 0,00 2398 481010557671 FAB. DE GLACONS. . . . . . . . . 0,00 2411 481010612284 TIROIR. . . . . . . . . . . . . 0,00 2412 481010611725 TIROIR. . . . . . . . . . . . . 0,00 2415 481010612288 TIROIR XXL. . . . . . . . . . . 0,00 2416 481010609763 VOLET. . . . . . . . . . . . . . 0,00 2418 481010622319 SEPARATEUR. . . . . . . . . . . 0,00 2447 481010621862 CLAYETTE VERRE CONGEL . . . . . 0,00 2448 481010611763 CLAYETTE VERRE. . . . . . . . . 0,00 2449 481010611745 CLAYETTE VERRE. . . . . . . . . 0,00 Réfrigérateur 1 porte - 850466411130 12/12/2016 Réfrigérateur 1 porte - Whirlpool - Réfrigérateur 1 porte - 850466411130 - WVE26962NFX 1/3 2458 481010622305 SUPP.BOUTEILLES 0,00 2497 481010621934 PROFILE CLAYET. BLANC, 417 mm. . 0,00 2614 481010620669 GUIDE GAUCHE. . . . . . . . . . 0,00 2615 481010620670 GUIDE DROIT. . . . . . . . . . . 0,00 2617 481010581785 SUPPORT. . . . . . . . . . . . . 0,00 2618 481010583931 SUPPORT. . . . . . . . . . . . . 0,00 2619 481010583984 SUPPORT. . . . . . . . . . . . . 0,00 3010 481010666735 BANDEAU DE COMMANDE GRIS MG 0,00 3014 481010559559 CACHE. . . . . . . . . . . . . . 0,00 3560 481010639736 PLATINE COMMANDE DOTYK 2.0 TOUC. 0,00 3561 481010717552 PANNEAU DE COMMANDE NOIR, UF60 . 0,00 4020 481010643140 COMPRESSEUR EMD 55 CLT TL CP. . 0,00 4022 480132101608 SOUPAPE. . . . . . . . . . . . . 0,00 4029 480132102058 PLATEAU DEGIVR . . . . . . . . . 0,00 4200 481212028055 CONDENSATEUR. . . . . . . . . . 0,00 4401 481010660514 VANNE. . . . . . . . . . . . . . 0,00 4409 481236058456 SOUPAPE. . . . . . . . . . . . . 0,00 4410 481010721751 HELICE VENT. assy UF60. . . . . 0,00 4900 481050285321 CORDON SECTEUR 2450MM,10-16A,25. 0,00 4910 480132102717 CAPOT PROTECT . . . . . . . . . 0,00 4913 481010553122 COUVERCLE BORNIER. . . . . . . . 0,00 5210 481010638353 PLATINE CONTROLE CENTAUR UF60 A. 0,00 5612 481229068325 BORNIER. . . . . . . . . . . . . 0,00 5620 481010527401 FUSIBLE THERM . . . . . . . . . 0,00 6140 481010643139 MONOBLOC SX.CA AE18BQ6 0,00 6520 481010518293 LED. . . . . . . . . . . . . . . 0,00 6521 481010512543 CACHE. . . . . . . . . . . . . . 0,00 6915 480132101611 COUVRE BULBE. . . . . . . . . . 0,00 6917 481231019153 SONDE. . . . . . . . . . . . . . 0,00 7400 481010607739 CONDENSEUR. . . . . . . . . . . 0,00 7401 481010682980 SUPPORT TUBE 0,00 7430 481010627087 CAPOT ARRIERE blanc UF60 0,00 7450 481010613419 ENS.EVAPORATEUR. . . . . . . . . 0,00 7640 481948028144 DES091- 9 gr (6,4 x 4,85 x 2,2. 0,00 Réfrigérateur 1 porte - 850466411130 12/12/2016 Réfrigérateur 1 porte - Whirlpool - Réfrigérateur 1 porte - 850466411130 - WVE26962NFX 2/3 7830 481281719208 SOUPAPE 1/4 BODY+TUBE 100MM . . 0,00 7831 481010559304 TUYAU 0,00 9026 481010632190 HABILLAGE DE BAC GRIS +HOT FOIL. 0,00 9040 481010676921 CACHE KIT GRIS, DROIT. . . . . . 0,00 9041 481010676922 CACHE KIT GRIS, GAUCHE. . . . . 0,00 9042 481010643194 CACHE CHARNIERE GRIS, GAUCHE. . 0,00 9043 481010643192 CACHE CHARNIERE GRIS, DROIT. . . 0,00 9651 480132102378 PION. . . . . . . . . . . . . . 0,00 9652 481010574993 FICHE GRIS, MG. . . . . . . . . 0,00 9934 481010674836 ACCUM.DE FROID BLANC. . . . . . 0,00 9991 481010535087 DOIGT. . . . . . . . . . . . . . 0,00 9993 481010632442 DOIGT. . . . . . . . . . . . . . 0,00 9999 481010680282 LKFINOX-Kit de juxtaposition po. 0,00 Réfrigérateur 1 porte - 850466411130 12/12/2016 Réfrigérateur 1 porte - Whirlpool - Réfrigérateur 1 porte - 850466411130 - WVE26962NFX 3/3 '; $subst = ""; $result = preg_replace($re, $subst, $str); echo "The result of the substitution is ".$result;

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