I am editing an existing project, and there was a bug being reported that the system doesn't accept if the numeric comes first in the input, like 99% Creative. But if you'll enter Creative 99%, the system accept it and save it in the database.
I check there existing code, and found out that they used this expression /^[\p{L}]+/u in preg_match. I googled over and found out to use \w but my senior wont accept my answer. He said its, unacceptable. This would give some issue.
Please check the script below, this is the one that i used:
$category= trim($_POST['category']);
if(preg_match('/\W/', $category)){
$error='Invalid Input';
}
He told me to test it, using some unicode character if it will accept like arabic texts, mixed (alphanumeric + arabic). It all works so it mean its fine but he still don't accept it. He told me to formulate another regex expression.
Do you have any idea what should i do? What could be the expression i can use. I really don't understand why \w is not acceptable.