preg interpretation question
preg interpretation question
am 11.01.2010 02:37:20 von Mark Murphy
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?
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: preg interpretation question
am 11.01.2010 10:52:19 von Ferenc Kovacs
if its a parameter for some shell code, then you need to douple escape
the escapest.
If I remember correctly, if you need an escape char in a string, you
can put it in with \\, but if you need to put an escape char to a
string which will be executed via exec/system/etc. then you have to
put an escaped escape char, so in the end you need four escape char.
correct me, if Im wrong.
Tyrael
On Mon, Jan 11, 2010 at 2:37 AM, Mark Murphy 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 i=
s
> \\/\\\\. Â Sees to me to say backslash, slash, backslash, backslash. =
 Why the
> need for so many backslashes?
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: preg interpretation question
am 11.01.2010 11:07:36 von Pierre Joye
On Mon, Jan 11, 2010 at 2:37 AM, Mark Murphy wrote:
> Can someone interpret this preg string for me?
>
> /[^a-z0-9\\/\\\\_.:-]/i
>
> Here is what I can decipher. =A0the match is case insensitive, and it exc=
ludes
> all letters, and numbers, and the characters _ . : and - (that is
> underscore, period, colon, and dash). =A0The part I don't understand is
> \\/\\\\. =A0Sees to me to say backslash, slash, backslash, backslash. =A0=
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,
--=20
Pierre
http://twitter.com/pierrejoye | http://blog.thepimp.net | http://www.libgd.=
org
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php