|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-10-05 05:50 UTC] cech at debian dot org
From Debian bug #114345 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=114345&repeatmerged=yes When presented with a perfectly valid regular expression that contains ?> in it, these characters are confused with those used to close a block of php code in the html file. Example: // $article = preg_replace("/<([^>]*)(\s+[^>]*)?>/s", // '', // $article); Even though this entire block is commented out, I still get a parse error due to the ?> in the regexp. The workaround seems to be use of the x modifier, and putting whitespace between the ? and >, like so... $article = preg_replace("/<([^>]*)(\s+[^>]*)? >/xs", Mike ---------- P.S. cannot there be a mail reportin interface? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 10:00:01 2025 UTC |
And $article = preg_replace("/<([^>]*)(\s+[^>]*)?>/xs", goes perfectly right, as it should. KISS example: $myvar = "ab?>cd"; should work (and does work). Inside strings everything is allowed, when you place // before the line, that string protection obviously doesn't work anymore.