3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "This is a text with John Doe", "This is a text with Max Müstermann ", "This is a text withJohn-Frank' Doe.", "This is a text with John/Doejlkjkjlk", ]; $pattern = "/^(?=.{25,999})(?=.*[a-z]{2})[a-zA-Z0-9äöü,.' -]+$/"; foreach ($strings as $string) { if (preg_match($pattern, $string)) { echo "Ok ==> $string" . PHP_EOL; } else { echo "error" . PHP_EOL; } }

preferences:
13 ms | 404 KiB | 5 Q