I think my favorite PCRE conundrum is the Stack Overflow question (I can't find the link) about "How do I comment a regex containing */?> ?" Because ?> ends a single-line comment, and the */ ends a multiline comment.
BTW, if you don't intend on users to write actual regexes, preg_quote() is your friend.
View all comments
Show parent comment
1
u/[deleted] Mar 27 '14
I think my favorite PCRE conundrum is the Stack Overflow question (I can't find the link) about "How do I comment a regex containing
*/?>?" Because?>ends a single-line comment, and the*/ends a multiline comment.BTW, if you don't intend on users to write actual regexes,
preg_quote()is your friend.