1/18/2011, "Uri Guttman" <u...@stemsystems.com> вы писали:
>>>>>> "AM" == Alexey Mishustin <shum...@shumkar.ru> writes: > AM> /(www.){0,1}(google\.).*\/(imgres)|(images)|(products)\?{0,1}/ > >> > >> {0,1} is just ? by itself. > > AM> Yes, I know. But I like the {a,b} syntax more :) It's more uniform than > AM> ?,+,* etc. > >it is noisier and more people know the shortcuts. code so other people >can read your code as it is for them, not yourself. It's interesting, do most people here think so? > >> you don't need to grab things that are not used later on. also why grab > >> each trailing word separately which means it will be hard to tell what > >> word was there. > > AM> Where did I grab things that are not used later? What do you mean by > AM> trailing word? > >look in perldoc perlre and look at the difference between (foo) and >(:?foo). "This may substantially slow your program. Perl uses the same mechanism to produce $1, $2, etc, so you also pay a price for each pattern that contains capturing parentheses. (To avoid this cost while retaining the grouping behaviour, use the extended regular expression (?: ... ) instead.)" Thanks. I'll know it. > >> using alternate delimiters means you don't need to escape / which makes > >> it easier to read. > > AM> Sure. > >see, you agree about easier to read. do the same with your use of {a,b}. I can consider the opinion of most people but I won't change my own opinion because of that. For me, {a,b} is easier. Clearer and easier. -- Regards, Alex. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/