On Fri, Jan 19, 2018 at 12:29 AM, Todd Chester <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote:


    On 01/18/2018 05:17 PM, mimosinnet wrote:

        The '?' is not necessary


    Indeed!

    I use `.*?` when I do not want the wild card to be
    "greedy"

    When I have a choice of using either, I always use
    `.*?` so I remember the difference and as a kind
    of comment that tells me not to be greedy.


    Thank you!
    -T

    "greedy" always cracks me up when I see it.  Daffy Duck
    comes to mind, shouting "Mine! Mine! Mine!"


On 01/22/2018 03:37 PM, Andy Bach wrote:
>> it will match the first chunk of stuff that is followed by whatever is after it (so, "/....*?/" the "?" is certainly unneeded

 > I use `.*?` when I do not want the wild card to be "greedy"

Right, but using it as the a modifier of the last "*" of an RE when it's not involved in a capture makes it useless
/(st..).*?/
/(st..).*/

are effectively identical and both work the same (for what matters, what ends up in $1) as
/(st..)/

 > Daffy Duck comes to mind, shouting "Mine! Mine! Mine!"

Stomping on Bugs (and later, the appearing jenie) - "Down! Down! Down! In! In! In"  in Ali Baba Bunny, I think.   'course when he beats up Taz over a dollar he says something like that.

Thank you!

Reply via email to