title: Regular expression in BASH
body: <p>I was hoping someone could answer my quick question as I am going nuts!</p>
  
  <p>I have recently started learning regular expressions in my Java programming however am a little confused how to get certain features to work correctly directly in BASH. For example, the following code is not working as I think it should.</p>
  
  <pre><code>echo 2222 | grep '2\{2\}'
  </code></pre>
  
  <p>I am expecting it to return:</p>
  
  <pre><code>22
  </code></pre>
  
  <p>I have tried variations of it including:</p>
  
  <pre><code>echo 2222 | grep '2{2}'
  echo 2222 | grep -P '2\{2\}'
  echo 2222 | grep -E '2\{2\}'
  </code></pre>
  
  <p>However I am completely out of ideas. I'm sure this is a simple parameter / syntax fix and would love some help! P.S I've done tons of googling and every reference I find does not work in BASH; regex's can run on so many different platforms and engines =/</p>