Jump to content

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


oldwizard

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.

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.

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.