Posted by jamen on 12/10/05 01:38
hendry wrote:
> I am looking for a function that checks there isn't non-valid URL
> characters in some input:
>
> http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
>
> if (preg_match("/[^a-zA-Z0-9$-_.+!*'(),]/", $uri))
Remember that in a character class the hypen (-) character has a very
special meaning. So escape it, or move it to the front or back of the class:
$-_
Means all the characters between $ and _ including $ and _
And escape the $-character to be sure php doesn't try to parse it as a
variable
/[^a-zA-Z0-9\$_.+!*'(),-]/
[Back to original message]
|