preg_math, I need to allow character /

Discussion in 'Developers' Forum' started by danf.1979, Dec 24, 2005.

  1. danf.1979

    danf.1979 ISPConfig Developer

    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 / ?

    Code:
    # 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.
     
  2. till

    till Super Moderator

    you can try this (untested!):

    Code:
    # 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:

    Code:
    # 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."));
     

Share This Page