PDA

View Full Version : preg_math, I need to allow character /


danf.1979
24th December 2005, 20:19
I got this code from another tool, and i want to allow the character / because it would be part of the instalation tool that I'm developing. How can I allow the character / ?


# If strange characters in $install_path, then error
if(!preg_match("/^[a-zA-Z0-9\-\.]{0,255}$/",$install_path)) $go_api->errorMessage($go_api->lng("The instalation path contains invalid characters."));


thank you.

till
27th December 2005, 15:12
you can try this (untested!):

# If strange characters in $install_path, then error
if(!preg_match("/^[a-zA-Z0-9\-\.\/]{0,255}$/",$install_path)) $go_api->errorMessage($go_api->lng("The instalation path contains invalid characters."));

or this:

# If strange characters in $install_path, then error
if(!preg_match("°^[a-zA-Z0-9\-\./]{0,255}$°",$install_path)) $go_api->errorMessage($go_api->lng("The instalation path contains invalid characters."));