Regular expressions are getting the better of me today. I've been searching google finding code that people say works ... and it doesn't for me!
Background: I want to validate user input into a text field. The input can contain: 1). English characters and numbers or 2). Greek character and numbers If symbols (&%!) etc are found it should not match!
Currently: Been testing this RegEx in PHP
/^[\p{Greek}\s\d a-zA-Z]+/u
testing with "γφψη 677" works testing with "γφψη 677###hello" works too!! - BUT I WANT THIS TO FAIL
<?php
header("content-type: text/html;charset=utf-8");
if (preg_match_all('/^[\p{Greek}\s\d a-zA-Z]+/u', 'γφψη 677###hello')){
echo "ok!";
}
else {
echo "no!";
}
?>
Any ideas?
Thank you in advance!!