I answered this question on SuperUser that was something related to kind of Regular expressions used while grepping an output.
The answer I gave was this :
tail -f log | grep "some_string.*some_string"
And then, In three comments to my answer @Bob wrote this :
.*is greedy and might capture more than you want.
.*?is usually better.
?is a modifier on
*, making it lazy instead of the greedy default. Assuming PCRE.
I googled for
PCRE, but couldn't get what's the significance of this in my answer ?
and finally this,
I should also point out that this is regex (grep doing POSIX regex by default), not a shell glob.
I only know what a Regex is and very basic usage of it in grep command. So, I couldn't get any of those 3 comments and I have these questions in mind :
- What are differences in usage of
- Which is better and under what circumstance? Please provide examples.
Also It would be helpful to understand the comments, If anyone could
NOTE: If needed, Please read my answer to this question before answering for referring to the context.