Jump to content

Warning: preg_match() [function.preg-match]: No ending delimiter '-' found in


Recommended Posts

Hi guys

i keep geting this warning on my site:

Warning: preg_match() [function.preg-match]: No ending delimiter '-' found in /home/content/96/10289996/html/libraries/Trash.php on line 501

 

and this is what is on line 501:

 

 if( preg_match( '-', $p ) ){

    $aExp   = explode( '-', $p );
 
can someone help me please.
 
Carlos

To directly answer your question, patterns need to be wrapped in delimiters (e.g /$pattern/, ~$pattern~).

But as Jessica said, strpos() will be a faster/more efficient solution for a character search in a string.

Well, if i say that is chinese to me would you believe it?

I know very little about php coding, can you please give me an example on how to wright the code?

Thanks for the quick response guys.

Carlos

The PHP manual contains lots of examples for all of the functions, especially the core functions like strpos. That's why we tend to recommend people to check it, if they are uncertain about how to use a function in PHP.

You'll find everything you need in it, not just examples, btw, but also definitions and user comments.

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.