Chris Wagner wrote: > At 05:11 PM 9/27/05 -0700, $Bill Luebkert wrote: > >>\s* means to grab any WS at the current position (including the case where >> there is none). >> >>\s*? means 0 or 1 of the above which is totally meaningless - you've already >> eaten all the WS with the \s*, so in my opinion the ? is redundant to >> what you have already done.
I retract the above \s*? stmt. \s*? won't grab any WS in this case because (\s*?) is not the same as (\s*)? (which is what I was thinking). > Redundant vs. Useless! Semantic battle of the century!! Who's right and > who's wrong: and will be put to DEATH! > > Redundant: > m/\s*\s/; # Specifying something again when it was already specified > > Useless: > m/xyz\s*?$/; # Specifying something that does nothing > > * maximal match, eat up as many characters as possible to make the overall > expression match > *? minimal match, eat up as few characters as possible to make the overall > expression match So in my revised opinion, it's not redundant, but it's not useless either - it's plain wrong. I'm sure the intent here is to eat as much WS as there is and that's not what \s*? will do for you. \s*? won't eat any WS. > That rule doesn't disappear just because a certain character sequence was > specified. *? is only *useful* when used with wildcards since it will decay > to a nul if used with a fixed string. The minimum of the range 0 to inf is 0. -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs