Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As far as I can tell, it doesn't. With GNU grep versions 2.5.3, 2.6.3, 2.10, and 2.12, I get:</p> <pre><code>$ echo "ABC ddd kkk DDD" | grep -Eo "[A-Z]+" ABC DDD $ echo "ABC ddd kkk DDD" | grep -Eo "[A-Z]*" ABC DDD </code></pre> <p>Please double-check your second example. If you can confirm that you get only one line of output, it might be a bug in your <code>grep</code>. If you're using GNU <code>grep</code>, what's the output of <code>grep --version</code>? If not, what OS are you using, and (if you know) what <code>grep</code> implementation?</p> <p><strong>UPDATE :</strong></p> <p>I just built and installed GNU grep 2.5.1 (the version you're using) from source, and I confirm your output. It appears to be a bug in that version of <code>grep</code>, apparently corrected between 2.5.1a and 2.5.3. GNU grep 2.5.1 is about 12 years old; can you install a newer version? Looking through the <code>ChangeLog</code> for 2.5.3, I suspect this may have been the fix:</p> <pre><code>2005-08-24 Charles Levert &lt;charles_levert@gna.org&gt; * src/grep.c (print_line_middle): In case of an empty match, make minimal progress and continue instead of aborting process of the remainder of the line, in case there's still an upcoming non-empty match. * tests/foad1.sh: Add two tests for this. * doc/grep.texi, doc/grep.1: Document this behavior, since --only-matching and --color are GNU extensions which are otherwise unspecified by POSIX or other standards. </code></pre> <p>Even if you don't have full access on the machine you're using, you should still be able to download the source tarball from <code>ftp://ftp.gnu.org/gnu/grep/</code> and install it under your home directory (assuming your system has a working compiler and associated tools).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload