I'm playing with regular expressions and I tried the \Q..\E escape sequence.
First try:
$regex = '/\Q http:// \E/';
var_dump(preg_match($regex, ' http:// '));
It tells me that '\' is unknown modifier, completely understandable.
Second try:
$regex = '/\Q http:\/\/ \E/';
var_dump(preg_match($regex, ' http:// '));
var_dump(preg_match($regex, ' http:\/\/ '));
It runs, not match the first string, but match the second one.
I know that I could use other delimiter character or solve it without \Q..\E, but I'm curious that how it works.
I through that at first it separates the regex from the modifiers by the delimiter (with handling the escaping if necessary) and after that the regex engine interprets the \Q..\E, but it seems like that when the \Q involved, then it not handles the escaped delimiter the same way.
What happens exactly at this case?
Thanks!