What are the potential pitfalls of using \d in regex patterns for numeric validation in PHP?

Using \d in regex patterns for numeric validation in PHP may not account for all numeric characters, such as decimals, negative signs, or commas. To ensure comprehensive numeric validation, it is better to use a more specific pattern that covers all possible numeric inputs.

// Use a more specific pattern for numeric validation in PHP
$number = "123.45";
if (preg_match('/^-?\d*\.?\d+$/', $number)) {
    echo "Valid numeric input";
} else {
    echo "Invalid numeric input";
}