note
linuxer
<p>I think, you could have a look at the official perldoc to get information about Perl's regular expressions:
<p>[doc://perlretut] - Tutorial
<p>[doc://perlrequick] - Quick Reference
<p>[doc://perlre] - Regex documentation
<p>And not to forget the pcre man pages:
<p>[href://http://www.pcre.org/pcre.txt]
<p>If you want/have to stick to <c>pcregrep</c>, I suggest something like:
<code>
pcregrep -v "^[^:]*:[^:]*:-?(1?\d?\d|20[0-4]):" /etc/passwd
</code>
<p>It (simplified) assumes/uses:
<ul>
<li> the pattern is anchored at beginning of line (<c>^</c>)</li>
<li> "login name" field must not contain a colon</li>
<li> "password" field must not contain a colon</li>
<li> "UID" field:
<ul>
<li> leading optional "-"</li>
<li>grouped alternatives:
<ul>
<li> number between 0 and 199 OR</li>
<li> number between 200 and 204</li>
</ul>
</ul>
<li> don't care about the rest of the line</li>
</ul>
844003
844003