preg_match只需要接受正浮点数

preg_match need for accept only positive floating point numbers . Example: 1.5 or 10 and not for -1.5 or -10 values. Thanks in advance.

if(preg_match("/^\d+(?:\.\d+)?$/", $number)){
    // do some process
}

Here (\.\d+)? is checking for optional decimal point with digits!

?: is used to avoid capturing the group.