title: Curly Braces with {} grep and regular expressions: Why does it exceed the maximum value?
body: <p>I've been self-studying shell scripting for a while now, and I came across this section of a Linux Fundamentals manual concerning grep and curly braces {}. My problem is that when I'm demanding a string pattern to search for using grep from a minimum to a maximum number of occurrences using {} or curly braces, my result exceeds the maximum that I specified.</p>
  
  <p>Here is what happened:</p>
  
  <pre><code>Express11:~/unix_training/reg_ex # cat reg_file2
  ll
  lol
  lool
  loool
  loooose
  Express11:~/unix_training/reg_ex # grep -E 'o{2,3}' reg_file2
  lool
  loool
  loooose
  Express11:~/unix_training/reg_ex #
  </code></pre>
  
  <p>When according to the manual, should not be the case as I am specifying here that I am only looking for strings containing two consecutive o's to three consecutive o's.</p>
  
  <p>EDIT: Actually, the reason why I did not understand how the curly braces worked was because of this simplistic explanation by the manual. And I quote:</p>
  
  <blockquote>
    <p>19.4.10. between n and m times
    And here we demand exactly from minimum 2 to maximum 3 times.</p>
  
  <pre><code>paul@debian7:~$ cat list2
  ll
  lol
  lool
  loool
  paul@debian7:~$ grep -E 'o{2,3}' list2
  lool
  loool
  paul@debian7:~$ grep 'o\{2,3\}' list2
  lool
  loool
  paul@debian7:~$ cat list2 | sed 's/o\{2,3\}/A/'
  ll
  lol
  lAl
  lAl
  paul@debian7:~$
  </code></pre>
  </blockquote>
  
  <p>Thanks to all those who replied.</p>