What are the best practices for using delimiters in preg_match for PHP patterns?

When using preg_match in PHP to match patterns, it is important to use delimiters to enclose the regular expression pattern. This helps to clearly define the start and end of the pattern. The most commonly used delimiter is the forward slash (/), but other characters like hash (#) or tilde (~) can also be used. It is best practice to choose a delimiter that is not present in the pattern to avoid conflicts.

// Example of using forward slash (/) as delimiter
$string = "Hello, World!";
if (preg_match("/Hello/", $string)) {
    echo "Pattern found!";
} else {
    echo "Pattern not found.";
}