3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/^(?=.{8,12}$)(?=[^A-Z]*[A-Z])(?=\D*\d)(?=(?:[^a-z]*[a-z]){3})(?=[^\s#*.!?$]*[#*.!?$])(?!.*(.)\1)(?:[a-z]|[A-Z])[a-zA-Z0-9#*.!?$,]+$/m'; $str = 'Abcd123!, Abcd123!, abcD123!,dfe abcD123,dfe abcD122!,dfe'; preg_match_all($re, $str, $matches); print_r($matches[0]); $strings = [ "Abcd123!,", "Abcd123!,", "abcD123!,dfe", "abcD123,dfe", "abcD122!,dfe" ]; $re2 = '/^(?=.{8,12}$)(?=[^A-Z]*[A-Z])(?=\D*\d)(?=(?:[^a-z]*[a-z]){3})(?=[^\s#*.!?$]*[#*.!?$])(?!.*(.)\1)(?:[a-z]|[A-Z])[a-zA-Z0-9#*.!?$,]+$/'; foreach ($strings as $string) { if (preg_match($re2, $string)) { echo "Match for $string" . PHP_EOL; } else { echo "No match for $string" . PHP_EOL; } }
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
Array ( [0] => Abcd123!, [1] => Abcd123!, [2] => abcD123!,dfe ) Match for Abcd123!, Match for Abcd123!, Match for abcD123!,dfe No match for abcD123,dfe No match for abcD122!,dfe
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
179.89 ms | 407 KiB | 5 Q