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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.