Regular Expressions 101

Save & Share

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

Code Generator

Generated Code

$re = '/(.*?)","|(.*?)$/'; $str = '<p>Calçat per a bebè nen. Vambes altes de denim. Fàcils de posar gràcies als cordons elàstics. Collet enconxat de cotó per a més comoditat. Ullets metàl·lics. Part de sobre de denim de cotó i collet de poliuretà. Folre i plantilla de cotó.<\\p><p>Plantilla: 100% cotó<br \\><p>Sola exterior: 100% cotó<br \\>Folre: 100% cotó<br \\>Part de sobre: 65% cotó, 35% poliuretà<\\p>","Baby-Schuhe Jungen. Knöchelhohe Sneaker mit elastischen Schnürsenkeln. Leicht anzulegen. Gesteppter Schaftkragen für mehr Komfort. Metallösen. Außenseite aus Baumwolldenim und Polyurethan, innen Baumwolle.","Baby-Schuhe Jungen. Knöchelhohe Sneaker mit elastischen Schnürsenkeln. Leicht anzulegen. Gesteppter Schaftkragen für mehr Komfort. Metallösen. Außenseite aus Baumwolldenim und Polyurethan, innen Baumwolle.","Shoes for baby boys. High-top sneakers with elasticated laces. Easy dressing. Quilted collar for comfort. Metal eyelets. Exterior in cotton denim and polyurethane and cotton interior.","<p>Zapatos para bebé niño. Deportivas altas de tela vaquera. Fáciles de poner gracias a los cordones elásticos. Cuello acolchado para mayor comodidad. Ojales de metal. Parte superior vaquera de algodón de poliuretano. Suela interior y forro de algodón.<\\p><p>Suela interior: 100 % algodón<br \\>Suela exterior: 100 % algodón<br \\>Forro: 100 % algodón <br \\>Parte superior: 65 % de algodón, 35 % de poliuretano<\\p>","<p>Chaussure bébé garçon. Baskets montantes en denim. Enfilage facile grâce aux lacets élastiqués. Col matelassé pour le confort. Œillets métal. Dessus en denim coton et col en polyurethane. Semelle intérieure et doublure en coton.<\\p><p>Semelle intérieure : 100% Coton<br \\>Semelle extérieure : 100% Coton<br \\>Doublure : 100% Coton<br \\>Dessus : 65% Coton, 35% Polyuréthane<\\p>","Chaussures pour bébé garçon. Chaussures de sport montantes à lacets élastiqués. Enfilage facile. Col matelassé pour le confort. Œillets en métal. Extérieur en denim de coton et polyuréthane et intérieur en coton.","<p>Chaussure bébé garçon. Baskets montantes en denim. Enfilage facile grâce aux lacets élastiqués. Col matelassé pour le confort. Œillets métal. Dessus en denim coton et col en polyurethane. Semelle intérieure et doublure en coton.<\\p><p>Semelle intérieure : 100% Coton<br \\>Semelle extérieure : 100% Coton<br \\>Doublure : 100% Coton<br \\>Dessus : 65% Coton, 35% Polyuréthane<\\p>","<p>Chaussure bébé garçon. Baskets montantes en denim. Enfilage facile grâce aux lacets élastiqués. Col matelassé pour le confort. Œillets métal. Dessus en denim coton et col en polyurethane. Semelle intérieure et doublure en coton.<\\p><p>Semelle intérieure : 100% Coton<br \\>Semelle extérieure : 100% Coton<br \\>Doublure : 100% Coton<br \\>Dessus : 65% Coton, 35% Polyuréthane<\\p>","Scarpe per bimbo. Basket alte con lacci elasticizzati. Si infilano facilmente. Collo imbottito per il massimo comfort. Occhielli in metallo. Esterno in denim di cotone e poliuretano e interno in cotone.","<p>Schoenen baby jongen. Hoge baskets van denim. Makkelijk aan te trekken dankzij de elastische veters. Gewatteerde kraag voor het comfort. Metalen oogjes. Bovenkant van denim en katoen en kraag van polyurethaan. Binnenzool en voering van katoen.<\\p><p>Binnenzool: 100% katoen<br \\>Buitenzool: 100% katoen<br \\>Voering: 100% katoen<br \\>Bovenkant: 65% katoen, 35% polyurethaan<\\p>","<p>Buty niemowleca dla chlopca. Trampki za kostke z denimu. Latwe do zakladania dzieki elastycznym sznurówkom. Wzmocniony material wokól kostki dla wiekszego komfortu. Metalowe oczka. Wierzch z bawelnianego denimu, góra buta z poliuretanu. Wysciólka i wkladka z bawelny.<\\p><p>Wkladka: 90% bawelna<br\\>Podeszwa: 100% bawelna <br \\>Wysciólka: 100% bawelny<br \\>Wierzch: 65% bawelnia, 35% poliuretan<\\p>'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); // Print the entire match result var_dump($matches);

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