title: unable to or two regex expression for grep
body: <p>I want to write a bash script that finds files according to the date they've been modified. for example, this <code>./find_by_date Jul</code> should output all files that are modified in <strong>Jul</strong> and this <code>./find_by_date 8</code> should output all files that are modified on the <strong>8</strong>th day of a month. and <code>find_by_date Jul 8</code> should find all files that are modified on <strong>July 8</strong>.</p>
  
  <p>this is what I have tried so far:</p>
  
  <pre><code>#!/usr/bin/env bash
  
  function find_by_date
  {
      date=$1;
      date=${date:?'missing'};
      echo $(ls -l | grep -i "(.\{37\}$date|.\{40\}$date)" | cut -c51-);
  }
  
  find_by_date $1
  </code></pre>
  
  <p>however, the regex for grep does not work properly. if I only use <code>.\{37\}$date</code> or <code>.\{40\}$date</code>, it works. but if I <code>or</code> them, it doesn't work.</p>
  
  <p>can anyone help me with the regex?</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>as suggested, I changed the regex to:</p>
  
  <pre><code>grep -i -E ".\{37\}$date|.\{40\}$date"
  </code></pre>
  
  <p>still doesn't work.</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>this is the directory that I'm running the test on:</p>
  
  <pre><code>-rw-r--r-- 1 fatemeh fatemeh     231 Jul  8 19:48 albums.txt
  -rw-r--r-- 1 fatemeh fatemeh      47 Jul  8 19:43 alice
  -rw-r--r-- 1 fatemeh fatemeh 2540187 Aug  8 00:26 output.txt
  -rwxrwxr-x 1 fatemeh fatemeh     178 Aug  8 23:55 p102_ex.sh
  -rwxrwxr-x 1 fatemeh fatemeh     349 Aug  4 20:53 p92_ex.sh
  -rwxrwxr-x 1 fatemeh fatemeh     330 Jul  7 23:55 p97_ex.sh
  -rwxrwxr-x 1 fatemeh fatemeh      98 Aug  8 00:33 p98_ex.sh
  -rwxrwxr-x 1 fatemeh fatemeh     255 Aug  9 00:35 stack.sh
  -rw-rw-r-- 1 fatemeh fatemeh     720 Aug  8 00:05 test.py
  -rwx-wx--x 1 fatemeh fatemeh     207 Aug  1 11:58 test.sh
  -rw-r--r-- 1 fatemeh fatemeh       0 Aug  7 00:24 tmp.txt
  </code></pre>
  
  <p>the output of <code>./find_by_date Jul</code> must be: <code>albums.txt alice p97_ex.sh</code> (all modified in July)</p>
  
  <p>the output of <code>./find_by_date 7</code> must be: <code>p97_ex.sh tmp.txt</code></p>
  
  <p>the output of <code>./find_by_date Aug 8</code> must be: <code>output.txt p102_ex.sh p98_ex.sh test.py</code></p>