Source Code:
(back to article)
<?php $pattern = '/^[a-zA-Z\s]+$/'; $string = 'This is a test string'; if (preg_match($pattern, $string, $matches)) { echo 'Match found.'; } else { echo 'No match found.'; }
Result:
Report an issue