Trying to understand the text from the manual.
http://php.net/manual/en/regexp.reference.escape.php
Separate and double quotes of PHP strings are especially important for backslashes. Thus, if \ should be matched with the regular expression \\, then "\\\\" or '\\\\' should be used in the PHP code.
Maybe I'm wrong, but here I go.
When you use something like
preg_match("/\\s/", $myString)
What he does is convert \\ to \, which in turn makes the string equal to \ s, so it behaves normally, that is, its value does not change, and the created regular expression '/ \ s /' internally matches " space "
To match \ s in a string, you need to do something like this
preg_match("/\\\\s/", $myString)
So, the answer: \ s or \\ s in the regex string does not matter, personally I think that using \ s is simpler and easier to understand.
source share