I know PHP for a long time, but I seem to know regular expressions, but I don’t understand the syntax itself.
For example, I don’t understand what is different
Perhaps I’m asking in the wrong place, but I don’t know where they write in detail about reg. expressions.
Answer 1, authority 100%
The last expression does not use the
/s (PCRE_DOTALL)modifier, which matches all characters in the template, including newlines. Those. in expression 1 and 2,
*matches all characters except for whitespace, and in expression 3, whitespace is included in the set.
Because one uses / and the other uses !
This should not affect the work. Separators are chosen for reasons of readability. Within an expression, the character used as a delimiter must be escaped