Topic: Preg_match errors - now what?

Initially had the function eregi errors and going over the stickied thread - I was able to replace them with preg_match commands. Now I am getting the following errors:

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

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

How do I go about this? They are errors in pages: inc/functions.inc.php and inc/shows.inc.php

Thanks

Re: Preg_match errors - now what?

preg_match needs a delimiter and you have not used one, eregi does not.
Usually / is used. You need to put one at each end of the values you are using like this:
/^[_a-zA-Z0-9-]{1,}$/

So

eregi("^[_a-zA-Z0-9-]{1,}$"

becomes

preg_match("/^[_a-zA-Z0-9-]{1,}$/"


Re: Preg_match errors - now what?

Thanks for the quick reply. After changing the code and adding "/". I got this error message:

Warning: preg_match() [function.preg-match]: Unknown modifier '$' in inc/functions.inc.php on line 20

Do we take out "$" sign?

preg_match needs a delimiter and you have not used one, eregi does not.
Usually / is used. You need to put one at each end of the values you are using like this:
/^[_a-zA-Z0-9-]{1,}$/

So

eregi("^[_a-zA-Z0-9-]{1,}$"

becomes

preg_match("/^[_a-zA-Z0-9-]{1,}$/"

Re: Preg_match errors - now what?

Line 20 should look like this:

if( isset($template) and $template != "" and !preg_match("/^[_a-zA-Z0-9-]{1,}$/", $template)){ die("invalid template characters"); }

Re: Preg_match errors - now what?

@Damoor
Thanks for helping me out. It finally works   http://cutephp.com/forum/style_emoticons/default/laugh.gif

Line 20 should look like this:

if( isset($template) and $template != "" and !preg_match("/^[_a-zA-Z0-9-]{1,}$/", $template)){ die("invalid template characters"); }