<p>I have a log file with dates in the format of <code>23 Aug 2019 05:26:53</code>, I want to filter on date wise, I have written pattern in my yaml file as :</p>

<pre><code>"pattern" : "\\(0?[1-9]|[12][0-9]|3[01]) [A-Z][a-z]{2} d{4}"
</code></pre>

<p>Can you please suggest me</p>

Lakshmi Reddy
<p>Here is a correction to your current regex pattern:</p>

<pre><code>(0?[1-9]|[12][0-9]|3[01]) [A-Z][a-z]{2} \d{4}
</code></pre>

<p>The days, month name, and year components are separate by space, not dash.  However, I might just use the following simplified (though more targeted) pattern:</p>

<pre><code>\d{1,2} [A-Z][a-z]{2} \d{4} \d{2}:\d{2}:\d{2}
</code></pre>

<p>It is highly likely that the above pattern would only target the timestamps in your log file, and it is easier to read than your version.</p>

<p><a href="https://regex101.com/r/1IMe7k/1" rel="nofollow noreferrer"><h2>Demo</h2></a></p>
