Skip to content

Instantly share code, notes, and snippets.

@miticojo
Last active May 29, 2021 09:43
Show Gist options
  • Save miticojo/c700af513417e217e76d21ff4b950c18 to your computer and use it in GitHub Desktop.
Save miticojo/c700af513417e217e76d21ff4b950c18 to your computer and use it in GitHub Desktop.
Usefull regex
  • /etc/fstab
    groups dev/mount/opts/ord1/ord2
    ^(?'dev'[^#][\w\S]*)\s*(?'mount'[\w\S]*)\s*(?'fs'[\w]*)\s*(?'opts'[\w\S]*)\s*(?'ord1'[\d]*)\s*(?'ord2'[\d]*)$
  • /etc/passwd
    groups user/uid/gid/desc/home/shell
    ^(?'user'[^#][\w\S]*):x:(?'uid'[\w]*):(?'gid'[\w]*):(?'desc'[\w\s]*):(?'home'[\w\S]*):(?'shell'[\w\S]*)$
  • /etc/shadow
    ^(?'user'[^#][\w-_]*):(?'passw'['\w$!\*']*):(?'last_pwd_ch'['\d']*):(?'minage'['\d']*):(?'maxage'['\d']*):(?'warnage'['\d']*):(?'inact_age'['\d']*):(?'expires'['\d']*):$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment