Re: preg_match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/1/06, Benjamin D Adams <badams@xxxxxxxxxxxxxx> wrote:
> I'm trying to check a string for ../
> <?php
>         if(preg_match("/..//i", $string)){
>                 echo "string has ../";
>         }
> ?>
>
> Can't get it to work can anyone help?

Since / is your delimiter you need to escape it.

Also '.' means anything so you need to escape that as well.

if (preg_match('/\.\.\//', $string)) ...

What are you trying to achieve? There may be a better way than using a
regular expression.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux