RegularRegExpressionsEx101
Regular Expression
v16
/
/
g
very simple test
Target: capture group 1 (undefined), Criteria: starts with
mixed kind of quotes
Target: capture group 3 (undefined), Criteria: starts with
quotes inside quotes v1
Target: capture group 4 (undefined), Criteria: is null
quotes inside quote v2
Target: capture group 4 (undefined), Criteria: equals
unquoted var inside simple quotes
Target: capture group 4 (undefined), Criteria: equals
simple quote stops because of space
Target: capture group 4 (undefined), Criteria: equals
simple quotes can contain odd number of double quotes
Target: capture group 4 (undefined), Criteria: equals
double quotes can contain odd number of simple quotes
Target: capture group 3 (undefined), Criteria: equals
each two following double quotes are separate arguments (1)
Target: capture group 3 (undefined), Criteria: equals
each two following double quotes are separate arguments (2)
Target: capture group 3 (undefined), Criteria: equals
each two following double quotes are separate arguments (3)
Target: capture group 3 (undefined), Criteria: equals
simple quotes ignore bounded simple quotes
Target: capture group 4 (undefined), Criteria: equals
Code Generator
Generated Code
$re = '/(?\'global\'(?:(?:(?\'plain_text\'[^\'"\s]+)(?=[\s"\']))|(?:"(?\'double_quotes\'(?:[^"]|(?<=\\\\)")*)"|(?:\'(?\'simple_quotes\'(?:[^\']|\'(?! )[^\']*\')*)\')|^[^\s]+$|^[^\s]+(?= )|(?<= )[^ ]+$)[^\s"\']*))/'; $str = '\'--data-urlencode\' \'datetime="2017-05-24 18:02:42"\''; 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