FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Are spaces not allowed in regular expressions?





imagefree
i am using this:

Code:
([0-9a-zA-Z\-\._]+)

heres the complete rule:
Code:
RewriteRule ^galleries/([0-9]+)/([a-z_\-]+)/([0-9]+)/([0-9a-zA-Z\-_]+)/slideshow/([0-9]+)/([0-9a-zA-Z\-\._]+)$ /slideshow.php?headid=$1&categoryname=$2&galleryid=$3&galleryname=$4&imageorder=$5&imagename=$6

and the error occures whenever i add space to any regx.

I want to add a space to the last one (shown in first code), but when i do it, it shows Server 500 error. This will represent filename and it works fine, but if a filename contains spaces it simply gives 404 error. I do not want to filter spaces from the file name, so the only option left is to modify htaccess.

Are spaces not allowed? or is there any other way to do this?
Peterssidan
I think you can use \s but I'm not sure if it only the space character.

I'm not sure but maybe you can escape the space:
Code:
([0-9a-zA-Z\-\._\ ]+)
imagefree
whenever i use \s or escape space character, it starts redirection loop. I dont know what makes it start redirecting.

Please help.
imagefree
ops, redirection problem solved now.

That was my script's internal redirection and the reason was that my script was not able to match the $_GET['imagename'] with the one saved in mysql.

i just used the following to get right result:

Code:
if( $imagename == urldecode($_GET['imagename'] )
{
    //continue script;
}
else
{
   //redirect
}

thanks Peterssidan
Related topics
Styling <abbr> in IE
Web Mailer, Create a "contact us" mailer
PHP Validation Class
writing COM components in Perl
PHP - Find and Delete
mysql_real_escape_string question
[JS] Regular expressions global match get first group
Complicated regular expression (for preg_replace)
how to use these regular expressions
Help with regular expression
Automatic Regular Expressions!
Need to find text in php files
Parsing XML Data using Regular Expressions
Robots.txt and Meta Robots
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.