Regular Expressions 101

Save & Manage Regex

  • Current Version: 11
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
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
Processing...

Test String

Code Generator

Generated Code

$re = '/(?:[(|\s\';",=])((?:http|\/|\\\\){1}(?:[\/:,~\\\\.\-\–\d_@%A-Za-z\p{L}\p{M}\p{N}]{10,}\.(?:jpg|jpeg|jpe|png|webp|svg|gif|css|js)))(?=(?:|\?|"|&|,|\s|\'|\)|\||\\\\|}))/uU'; $str = ' <p custom-attr=http://example.org/wp-content/uploads/2018/05/brands.png> [16] => https://www.mueblesexpress.com.uy/wp-content/plugins/divi-bars/assets/js/snap.svg-min.js /wp-content/plugins/optimole-wp/assets/img/log4.pngRANDOMSTUFF http://96e363596fbe.ngrok.io/wp-includes/js/hoverintent-js.min.png-random.css http://example.org/wp-includes/js/assets/whatever.jpg.png.css.js \'; http://example.org/wp-content/themes/test/assets/images/header.pnghttps://example.org/wp-content/themes/test/assets/images/header.png http://example.org/wp-content/themes/test/assets/images/header.pnghttp://example.org/wp-content/themes/test/assets/images/header.png https://test123.i.optimole.com/F7bDy7k-fXTTyV95/f:js/q:auto/m:0/http://example.org/wp-content/plugins/images/img.jpg [17] => http://96e363596fbe.ngrok.io/wp-includes/js/hoverintent-js.min.js [18] => http://96e363596fbe.ngrok.io/wp-includes/js/admin-bar.min.js [19] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/jquery-blockui/jquery.blockUI.min.js [20] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js [21] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/js-cookie/js.cookie.min.js [22] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/frontend/woocommerce.min.js [23] => http://96e363596fbe.ngrok.io/wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.min.js [24] => http://96e363596fbe.ngrok.io/wp-content/plugins/smart-search-for-woocommerce/assets/js/se-widgets.js [25] => http://96e363596fbe.ngrok.io/wp-content/themes/twentynineteen/js/priority-menu.js [26] => http://96e363596fbe.ngrok.io/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js [27] => http://96e363596fbe.ngrok.io/wp-includes/js/wp-embed.min.js http://example.org/wp-content/themes/test/assets/images/header.png http://example.org/wp-content/themes/test/assets/images/header.jpeg http://example.org/wp-content/plugins/optimole-wp/assets/img/logo1.png http://example.org/wp-content/plugins/optimole-wp/assets/img/logo2.png?width=500&cr=small http://example.org/wp-content/plugins/optimole-wp/assets/img/logo3.png%3Fwidth%3D500%26cr%3Dsmall http://example.org/wp-content/uploads/2018/05/umlauts_image_äöü.jpg http://example.org/uploads/2018/05/umlauts_image_a\\u0308o\\u0308u\\u0308.jpg //example.org/wp-content/themes/test/assets/images/header2.png //example.org/wp-content/themes/test/assets/images/header2.jpeg //example.org/wp-content/plugins/optimole-wp/assets/img/logo4.png //example.org/wp-content/plugins/optimole-wp/assets/img/logo2.png?width=500&cr=small //example.org/wp-content/plugins/optimole-wp/assets/img/logo3.png%3Fwidth%3D500%26cr%3Dsmall //example.org/wp-content/uploads/2018/05/umlauts_im4age_äöü.jpg //example.org/uploads/2018/05/umlauts_5image_a\\u0308o\\u0308u\\u0308.jpg /wp-content/themes/test/assets/images/header4.png /wp-content/themes/test/assets/images/header7.jpeg /wp-content/plugins/optimole-wp/assets/img/logo9.png /wp-content/plugins/optimole-wp/assets/img/lo2go.png?width=500&cr=small /wp-content/plugins/optimole-wp/assets/img/log4.png%3Fwidth%3D500%26cr%3Dsmall /wp-content/uploads/2018/05/umlau1ts_image_äöü.jpg /wp-content/uploads/2018/05/umlau1ts_image_a\\u0308o\\u0308u\\u0308.jpg'; 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