preg_replace and e option (bug or feature?)

From: Date: Fri, 05 May 2000 13:34:58 +0000
Subject: preg_replace and e option (bug or feature?)
Groups: php.dev 
Request: Send a blank email to php-dev+get-18449@lists.php.net to get a copy of this message
Hiya i was playing with the preg_replace function and found some annoying problems maybe this is food for a feature request :) but i first want to hear you guys take this text: $text = "#!this 'is' a \"test\" :)!#"; say i want everyting between #! and !# feed and replace to addslashes you sould say i do : $new_text = preg_replace("'#!(.*?)!#'ie", 'Addslashes("\\1")', $text); but because of the " and the ' this will fall due the eval of preg_replace resulting in a: Parse error: parse error in Unknown on line 0 i suggest the founded strings in the regular can be called like this to overcome this problem: $new_text = preg_replace("'#!(.*?)!#'ie", 'Addslashes($1)', $text); Anyone has comment on this? Greetz, Wico

« previous php.dev (#18449) next »