How can the error "Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash" be resolved in PHP?

The error "Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash" occurs when the delimiter used in the preg_match function is an alphanumeric character or a backslash. To resolve this issue, you need to choose a different delimiter that is not alphanumeric or a backslash, such as a hash (#) or a tilde (~).

$pattern = '/example/';
$string = 'This is an example string';
if (preg_match($pattern, $string)) {
    echo 'Match found!';
} else {
    echo 'No match found.';
}