Regular Expressions 101

GECOS and /etc/passwd

Open Workspace
  • PCRE2 (PHP)
  • Match
0

Regular Expression

/
^(?'username'.*):.*:(?'UID'.*):(?'GID'.*):(?'GECOS'.*):(?'home'.*):(?'shell'.*)$
/
gm

Description

Pull out fields in /etc/password and group.

Submitted by Anonymous