Hi Gerard,

all the preg_* functions require delimiters surrounding regular expressions.

$foo = '\[this\](.*?)that';

should be by default:

$foo = '/\[this\](.*?)that/';

the code you tried uses # as the delimiter instead of /, an option preg_*
allows

Take care,
Greg
--
phpDocumentor
http://www.phpdoc.org

"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>   The example doesn't have to make sense, but Im looking for the correct
> syntax for $foo.  I was trying ->
> $foo = '\[this\](.*?)that';
> $bar = 'the other';
>
> $str = preg_replace($foo, $bar, $other_string);
>
> But that doesn't work.  I came across an example where the syntax of
> $foo is in ->
> $foo = '#\[this\](.*?)that#';
>
> The second syntax of $foo works.  I was wondering on the meaning of # in
> the string??
>
> Thanks
>
> --
> Gerard Samuel
> http://www.trini0.org:81/
> http://dev.trini0.org:81/
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to