homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

PCRE with mod rewrite

 2:41 pm on Nov 16, 2010 (gmt 0)

Anyone now if mod_rewrite engine includes an underscore with \w, like Perl, some engines don't as I understand it? I know rewrite supports the char class alnum.

\w = [a-zA-Z0-9_]
[:alnum:] = [a-zA-Z0-9]

RewriteCond %{QUERY_STRING} f=(\w+)
RewriteCond %{QUERY_STRING} f=([[:alnum:]_])

I'll have time to set up a test HTTP Server later but not today, so I can't test myself. Apologizes! I hate asking questions I can get the answer to myself but I need to know today.




 4:07 pm on Nov 16, 2010 (gmt 0)

Apache supports PCRE, however it doesn't (appear to) know about things like [:alnum:] used. I was able to use \w and \d, for example.




 10:55 pm on Nov 17, 2010 (gmt 0)

When in doubt, use the old-style POSIX expressions for best results (and portability). Use of the [NC] flag on the RewriteCond or RewriteRule (as applicable) can make this slightly less painful, so as to avoid having to specify both upper- and lower-case ranges.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved