Any questions involving matching text strings to patterns - the pattern is called a "regular expression."
Moderator: General Moderators
-
anjanesh
- DevNet Resident
- Posts: 1679
- Joined: Sat Dec 06, 2003 9:52 pm
- Location: Mumbai, India
Post
by anjanesh »
Hi
Whats the difference between .* and .*? ?
Apache's mod_rewrite doesnt even allow the ? met character.
Thanks
-
Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Post
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

-
anjanesh
- DevNet Resident
- Posts: 1679
- Joined: Sat Dec 06, 2003 9:52 pm
- Location: Mumbai, India
Post
by anjanesh »
Ah...Thanks.
But why isnt Apache's mode_rewrite allowing the ? meta char ?
-
feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Post
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
