Re: [PHP-WIN] preg interpretation question

[email protected] (Pierre Joye)
Newsgroups php.windows
Message-ID <[email protected]>
On Mon, Jan 11, 2010 at 2:37 AM, Mark Murphy <[email protected]> wrote:
> Can someone interpret this preg string for me?
>
> /[^a-z0-9\\/\\\\_.:-]/i
>
> Here is what I can decipher.  the match is case insensitive, and it excludes
> all letters, and numbers, and the characters _ . : and - (that is
> underscore, period, colon, and dash).  The part I don't understand is
> \\/\\\\.  Sees to me to say backslash, slash, backslash, backslash.  Why the
> need for so many backslashes?

Reserved character has to be escaped using \, and \ is a reserved character.

Btw, ereg is deprecated, I would suggest to use PCRE instead,
http://www.php.net/pcre

Cheers,
-- 
Pierre

http://twitter.com/pierrejoye | http://blog.thepimp.net | http://www.libgd.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.