find command with 'regex' match not working
<p>Am trying to do a simple file-name match with this below regex which I tested to be working from this <a href="https://regex101.com/" rel="noreferrer"><code>page</code></a> for a sample file-name <code>ABC_YYYYMMDDHHMMSS.sha1</code></p>

<pre><code>ABC_20[0-9]{2}(0[1-9]|1[0-2])([0-2][0-9]|3[0-1])([0-2][0-3])([0-5][0-9])([0-5][0-9])\.sha1
</code></pre>

<p>When I couple this in the <code>-regex</code> flag of <code>find</code> like</p>

<pre><code>find . -type f -regex "ABC_20[0-9]{2}(0[1-9]|1[0-2])([0-2][0-9]|3[0-1])([0-2][0-3])([0-5][0-9])([0-5][0-9])\.sha1"
</code></pre>

<p>the command is not identifying the file present in the path (e.g <code>ABC_20161231225950.sha1</code>). Am aware of many existing regex-types from this <a href="https://www.gnu.org/software/findutils/manual/html_mono/find.html#Base-Name-Patterns" rel="noreferrer"><code>page</code></a>, but I realized my type is <code>posix-extended</code> and tried as below,</p>

<pre><code>find . -type f -regextype posix-extended -regex 'ABC_20[0-9]{2}(0[1-9]|1[0-2])([0-2][0-9]|3[0-1])([0-2][0-3])([0-5][0-9])([0-5][0-9])\.sha1'
</code></pre>

<p>and still no result. I searched around some similar questions of this type, but they were involving giving the wrong regex leading to files not being found. In my case, though the regex is found to be proper. I need to know what am I missing here. Also possibly how to debug non matching issues when using <code>-regex</code> in <code>find</code>.</p>

<p>Note:- I could do some optimizations over the capturing groups in the regex, but that is not in the scope of the current question.</p>