TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   preg (http://www.talkphp.com/general/2485-preg.html)

Orc 03-17-2008 04:19 PM

preg
 
I don't know much about preg besides a ^,$,{.+ | *} and more

Now I tried a test, and replacing this:
PHP Code:

<?php

$var 
"foobar";
$reg "^\/{foo}\/$";
if (
preg_match($reg$var))
{
    echo 
preg_replace($reg''$var);
}

?>

I got this error:
No ending delimiter '^' found
ANd if I remove that,
I get the $ not found. So can someone help me?

Salathe 03-17-2008 04:24 PM

For the preg_* functions, the pattern needs to be surrounded by delimiters. Usually the delimiter is a forward slash: something like /^foo/

The PCRE Pattern Syntax page on the PHP manual should be more than enough to get you sorted.


All times are GMT. The time now is 07:36 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0