How does PHP use regular matching to prevent users from entering negative numbers?

$matches = -50;
$res = preg_match("/[1-9]{1,10}/",$matches);
print_r($res);  //1

as shown in the code above, I don"t match the-sign regularly, but I can still enter a negative number. What"s going on?
how can I use regular expressions to disable the input of negative numbers.

Feb.24,2022

if you don't have to be regular, you don't have to be irregular.
if you have to use it, then

</span>

^$

$matches = -50;
$res = preg_match('/^[1-9]{1,10}$/',$matches);
print_r($res);  //0

if you just want to use regularity to determine whether it is a negative number, you can do so

$matches = -50;
$res = preg_match('/-/',$matches);
print_r($res);//1, 

if the requirement is to determine whether it is a non-negative number, it can also be like this

$matches = -50;
if(is_numeric($matches) && $matches >= 0) {
    print_r('');
} else {
    print_r('');
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38225-2b940.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38225-2b940.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?