Regular Expressions 101

Save & Share

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

/
/
s

Test String

Code Generator

Generated Code

$re = '/\[vc_column_text\](.*?)\[\/vc_column_text\]/s'; $str = 'Our good homies <a href="https://www.facebook.com/yungskeeter">DJ Skeet Skeet aka Yung Skeeter</a> &amp; <a href="https://www.facebook.com/WaxMotif">Wax Motif</a> have teamed up to do a colossal 2-track EP and we\\\'re getting the exclusive sneak-premiere of the EP\\\'s diabolical techno b-side called "Hush Hush" before its released tomorrow on <a href="https://www.facebook.com/dimmakrecs">Dim Mak Records</a>! [soundcloud url="http://api.sndcloud.com/tracks/104477594"] <a href="https://www.facebook.com/WaxMotif">Wax Motif</a> have teamed up to do a colossal 2-track EP and we\\\'re getting the exclusive sneak-premiere of the EP\\\'s diabolical techno b-side called "Hush Hush" before its released tomorrow on <a href="https://www.facebook.com/dimmakrecs">Dim Mak Records</a>! [vc_row_inner] [vc_column_inner width="3/12"] [gem_textbox content_background_color="#f0f3f2" centered="1" padding_top="25" padding_bottom="25" padding_left="0" padding_right="0"]<img class="alignnone size-medium wp-image-6608" src="https://shop.teor.events/wp-content/uploads/2020/09/Screenshot_2020-09-30-home-Business-300x223.png" alt="" width="300" height="223" />[/gem_textbox] [/vc_column_inner] [vc_column_inner width="5/12"] [vc_column_text] Vino Rosso Passito Uve:100% Vernaccia NeraVigneti:Loc. Sogliano -ColleluceBottiglie prodotte: 2.500 unica edizione.. Tipo di terreno:ghiaioso-breccioso. Esposizione: sud-est a 500 m.s.l.m. Resa per ettaro: 5-7tonnellate.  Acidità totale:5,40% . Estratto secco:38,80 ‰.Zuccheri residui:12g/l. Processo: raccolta e selezione a mano, appassimento delle uve in apposite cassette in legno per 2-3mesi, fermentazione in barriques per 18 mesi e affinamento in bottiglia per almeno 6 mesi. <div class="wpb_text_column wpb_content_element "> <div class="wpb_wrapper"></div> </div> [/vc_column_text] [/vc_column_inner] [vc_column_inner width="4/12"] [gem_textbox content_background_color="" padding_top="10" padding_bottom="0" padding_right="0" padding_left="18" border_color="#cccccc" border_width="1"][gem_dropcap shape="circle" letter="1" color="#9b4ce4" border_color="#9b4ce4"] [vc_empty_space height="3px"] [vc_column_text] &nbsp; AZIENDA AGRICOLA COLLELUCE &nbsp; [/vc_column_text] [gem_divider margin_top="20"][/gem_textbox][gem_divider margin_top="-25"][gem_textbox content_background_color="" padding_top="10" padding_bottom="0" padding_right="0" padding_left="18" border_color="#cccccc" border_width="1"][gem_dropcap shape="circle" letter="2" color="#4f67e1" border_color="#4f67e1"][vc_empty_space height="3px"][vc_column_text] &nbsp; CONTRADA SOGLIANO SERRAPETRONA &nbsp; [/vc_column_text][gem_divider margin_top="20"][/gem_textbox][gem_divider margin_top="-24"][gem_textbox content_background_color="" padding_top="10" padding_bottom="0" padding_right="0" padding_left="18" border_color="#cccccc" border_width="1"][gem_dropcap shape="circle" letter="3" color="#00bcd4" border_color="#00bcd4"][vc_empty_space height="3px"][vc_column_text] &nbsp; 62020 - (MC) &nbsp; [/vc_column_text][gem_divider margin_top="20"][/gem_textbox][/vc_column_inner][/vc_row_inner]'; preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 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