Page 1 of 1

Diff b/w Apache and PHP

Posted: Wed Aug 10, 2005 12:30 pm
by anjanesh
Hi

Whats the difference between .* and .*? ?
Apache's mod_rewrite doesnt even allow the ? met character.

Thanks

Posted: Wed Aug 10, 2005 12:40 pm
by Chris Corbyn
.* keeps eating until there's nothing left infront of it
.*? stops if the next metacharacter in the pattern is allowed to eat a character ;)

It's called greediness - It's explained pretty well on regular-expressions.info and in perldoc ;)

Posted: Wed Aug 10, 2005 1:30 pm
by anjanesh
Ah...Thanks.

But why isnt Apache's mode_rewrite allowing the ? meta char ?

Posted: Wed Aug 10, 2005 3:07 pm
by feyd
not that I remember. .*? is extended regex, from what I remember. mod_rewrite only supports a simple level of regex

This is why I often send my mod_rewrite code through a script to process :)