I have read this and this, and this, and half a dozen other questions about preg_match on SO, and I still can’t figure this one out.
I went to use this code from a CodeReview question and got an error saying that there was a preg_match() no deliminator ‘/’ found.
Can someone help me fix it? The code in question is this statement:
if (preg_match($regex, $user_agent)) {
You can find it by going to the bottom of the new, edited version of the code in the question itself, and counting up approx 12 lines (not counting blank lines).
Looking at the code posted on Code Review, in the $os_array there is the following line:
It is missing the
/ifrom the end of the regex on that line, which is probably causing your error. The line above that is also missing theibut this won’t break anything.As paxdiablo suggested, printing our your
$regexvariable inside the loop should have found this problem quickly.