<?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; } }
You have javascript disabled. You will not be able to edit any code.