Home
In modern apache, mod_rewrite uses PCRE instead of your system's regexp. One thing to watch out for in rules is greediness. Basically, each matching rule will attempt to match the maximum amount allowable to satisfy a rule. This, however, is rarely what you want when using statements like (.*) in the middle of a RewriteRule. (although it's usually exactly what you want at the end of a rule).

Here's a basic demonstration (watch how $1 takes the largest possible string):
#Rewriting with two greedy capture anything statements split by a '/'
RewriteRule ^/test/(.*)/(.*)$ /foo?one=$1&two;=$2 [R,L]

Results:

request
> GET /test/foo/bar/moo HTTP/1.1

response
< HTTP/1.x 302 Found
< Location: http://mspo.com/foo?one=foo/bar&two;=moo

Now switch to non-greedy mode:
#Rewriting with one non-greedy capture anything followed by a greedy (see how $1 takes the smallest possible string)
RewriteRule ^/test/(.*?)/(.*)$ /foo?one=$1&two;=$2 [R,L]

Results:

request
> GET /test/foo/bar/moo HTTP/1.1

response
< HTTP/1.x 302 Found
< Location: http://reallygothic.com/foo?one=foo&two;=bar/moo

When using aggressive captures (.+) or (.*) in the middle of your rule, think carefully about using the ? to modify greed characteristics to make sure you get exactly what you want.

For extra testing confusion, a test with just two parameters (GET /test/foo/bar HTTP/1.1) would have shown these two rules to be exactly the same.