Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
<?php // i: case-insensitive preg_match("/hello/i", "Hello World"); // matches // m: ^ and $ match line boundaries preg_match_all("/^\w+/m", "line1 line2 line3", $m); // $m[0] = ["line1", "line2", "line3"] // s: dot matches newline preg_match("/start.*end/s", "start middle end"); // x: extended/verbose mode — whitespace and # comments ignored $pattern = "/ ^ # Start of string (\d{4}) # 4-digit year - # Separator (\d{2}) # 2-digit month - # Separator (\d{2}) # 2-digit day $ # End of string /x";
Result
Open