Jump to content

regex Error with preg_replace()


dsaba

Recommended Posts

i get this error:

 

Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 on line 53

 

here is a snippet of problem code:

$constant = strtolower(add_underscores($searchfor));
	$constantized = concactenate($constant); //makes: '.Hello_World.'
	if (strpos($source_code, $searchfor_slashes) != FALSE) {
	$source_code = str_replace($searchfor_slashes, $constantized, $source_code);
	$source_code = preg_replace('/[^\\]\'\.?/', '', $source_code); // line 53
	//$source_code = str_replace("''.", "", $source_code);
	$source_code = str_replace(".''", "", $source_code);
	echo 'Concactenated: <b>'.$constant.'</b> in <em>'.$file.'</em>';
	echo 'finished if space was two in '.$file.'<br>';

 

 

anyone know how to fix this error? i dont understand i've used this regex several times before and have never gotten this error until now, very odd indeed...

Link to comment
https://forums.phpfreaks.com/topic/53156-regex-error-with-preg_replace/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.