Probably you should use PHP to replace 'spaces' with something else that can be found within their username.
If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.
Register Today on DNForum IT'S FREE!Hi,
I am having a basic problem with Regular Expressions and the Mod_Rewrite rule. I need to pattern match the space (" ") character ???
I am trying to rewrite a URL which contains a username variable:
RewriteRule ^([a-zA-Z0-9_.]*)/index.html /index.php?username=$1 [L,NC]
This works fine with usernames like "Dave_439" or "Emma.C", but unfortuantely the site I'm working on also alows users to have spaces in their username, so I also need to match "Dave 439" or "Emma C".
Does anyone know how to include spaces in my Regular Expression?
(Obviously I have tried [a-zA-Z0-9_. ]* which generates errors...)
★ Neil Hillman - Web Developer, Pixel Pusher...
Probably you should use PHP to replace 'spaces' with something else that can be found within their username.
Thanks, but I figured it out, you have to escape the space with a backslash:
[a-zA-Z0-9_\.\ ]*
★ Neil Hillman - Web Developer, Pixel Pusher...
If you escape 'space' with backslash, what did the url looks like? I mean will it looks like this?
1) http://yourdomain.com/dave%20439
or this?
2)http://yourdomain.com/dave_439
Bookmarks