I have not seen anyone directly access the PHP error, so I will try to explain.
The reason for the [Unknown] [Unknown] error is because you forgot to wrap your regular expression in delimiters. PHP just takes the first character as a delimiter if it's not an alphanumeric, non-whitespace ASCII character. So in your regex:
preg_match("(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+", $subject, $matches);
PHP thinks what you mean ( like an opening delimiter. Then it finds what it thinks is your closing delimiter, the next one ) and assumes that it follows the template modifiers. However, it discovers that your first template modifier, the next character after the first ) , is [ . [ is obviously not a valid template modifier, so you get an error that you are executing.
The solution is to simply wrap your regular expression in delimiters and make sure that any delimiters in the regex that you want to match literally are reset. I like to use ~ as delimiters, b / c you rarely have to match the literal ~ in regex.
m4olivei Mar 07 '15 at 1:25 2015-03-07 01:25
source share