Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I went to use this code from a different 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).

share|improve this question
Post your related code in this question. – xdazz Jul 5 '12 at 3:40
this is off topic (faq); it belongs on Stack Overflow (moderators will probably migrate it). – codesparkle Jul 5 '12 at 6:43
@codesparkle I figured out about the difference between here and SO right after I posted it, but I heard horror stories of people getting their accounts banned for deleting questions, so I was scared to delete it. The SO question is available here – Chris Mirno Jul 5 '12 at 14:54
FYI had already reposted prior to thinking about migration. My sincere apologies. :( – Chris Mirno Jul 5 '12 at 14:57
it won't be a problem, this one will probably be closed soon ;) – codesparkle Jul 5 '12 at 16:12

closed as off topic by codesparkle, mseancole, Quentin Pradet, palacsint, sepp2k Jul 13 '12 at 21:14

Questions on Code Review Stack Exchange are expected to relate to code review request within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

up vote 0 down vote accepted

I don't really use preg_match(), so I can't be positive this is the actual problem, but it sounds like your pattern, $regex, is not properly set up. This function expects a pattern to be wrapped in forward slashes "/" then usually followed by a flag. In the first instance in the link you provided, it searches for "/windows|win32/i" in other words "windows" or "|" "win32" case-insensitive "i". Without seeing what you are searching for this is the best I can do. Hope this helps!

P.S. O and BTW, as codesparkle mentioned, this should have been posted on SO.

share|improve this answer
I figured out about the difference between here and SO right after I posted it, but I heard horror stories of people getting their accounts banned for deleting questions, so I was scared to delete it. The SO question is available here – Chris Mirno Jul 5 '12 at 14:55
I don't think you have to worry about getting banned for deleting your own question. But usually its better to wait before reposting it so that the moderators have time to migrate it for you, this prevents duplicate questions. Most likely this will end up getting moved only to be flagged for deletion because its a duplicate :) – mseancole Jul 5 '12 at 15:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.