note 84931 deleted from function.preg-split by danbrown

From: Date: Wed, 27 May 2009 13:48:24 +0000
Subject: note 84931 deleted from function.preg-split by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156063@lists.php.net to get a copy of this message
Note Submitter: harrismw at ids dot org dot au ---- So yeah, my nice little function I posted below. Guess what, it doesn't work for all cases. If you know your way around regular expressions and the like then this might not come as a surprise, but it did surprise me. Basically, certain characters aren't welcome. If you try and include a bit of PHP in your patterns, then it might screw up your entire thing. E.g. < ? php if(!$suppressitemPHP) { (Without the spaces between the < ? and php), isn't welcome, which bit? In this case having a single '{' is the problem. And I also suspect that the '(' and ')' and maybe '<', '?' and '$' are problems as well, but I'm not so sure. I'm doing my research, and when (if) I come up with an answer, I'll post a revised function which will let me do what I want. (It may be as simple as escaping those chars in the pattern, I'm not sure.) So yeah, use the function below, it works well, just be careful is all, it doesn't work all the time.

« previous php.notes (#156063) next »