How can one test a modified regular expression in PHP to ensure it matches the desired patterns?

To test a modified regular expression in PHP to ensure it matches the desired patterns, you can use the `preg_match()` function. This function allows you to test a string against a regular expression pattern and returns true if a match is found. You can also use online regex testers to quickly test your regular expression patterns before implementing them in your PHP code.

$pattern = '/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/'; // Example regular expression pattern
$string = '123-456-7890'; // Example string to test

if (preg_match($pattern, $string)) {
    echo "Pattern matched!";
} else {
    echo "Pattern not matched.";
}