Dideved - 8:19 am on May 4, 2013 (gmt 0) [edited by: Dideved at 8:24 am (utc) on May 4, 2013]
> I was taught that if you don't have to use something greedy
> like .* then you shouldn't.
Though, this disagreement isn't actually about greedy vs non-greedy. The alternatives still use "*" and "+", both greedy quantifiers. The part they actually change is the ".". They would rather change it to something like [^.], even when doing so will introduce a bug.
> Because if you use it incorrectly, like not providing an
> exit from a redirection, you'll always end up in a loop.
This is actually a completely different rationale from what others here have expressed. A few people here advocate avoiding .* for performance reasons. Though, this turned out to be an insignificant micro-optimization.
Your reason for avoiding .*, however, seems to be that it can be used incorrectly. And I would agree that beginners often don't realize they've written themselves into a loop. But it seems to me that this should be a reason to emphasize the teaching of .* and rewrite conditions for beginners. It shouldn't be a reason to ban .* for veterans.
> Also, I really think it's strange when people do this:
I agree. There's no good reason for that. But if we're in a situation where .* is indeed the right tool for the job, then we shouldn't be afraid to use it.
[edited by: Dideved at 8:24 am (utc) on May 4, 2013]