The chars at the start and the end are
delimiters (preg_match requires them), and the pattern is inside the delimiters.
PHP: Delimiters - Manual[
^]
Quote:
When using the PCRE functions, it is required that the pattern is enclosed by delimiters. A delimiter can be any non-alphanumeric, non-backslash, non-whitespace character.
Often used delimiters are forward slashes (/), hash signs (#) and tildes (~).
So to answer your question "What's the difference?": the difference is only the delimiters, the patterns themselves have no difference.
But what's the purpose of allowing to choose a delimiter? That's also explained in the manual I linked above:
Quote:
If the delimiter needs to be matched inside the pattern it must be escaped using a backslash. If the delimiter appears often inside the pattern, it is a good idea to choose another delimiter in order to increase readability.