DEV Community


Discussion on: Using Regular Expressions to Filter Your Server’s Logs

learnbyexample profile image
Sundeep • Edited

quick question, which grep allows you to use \d? as far as I know, only GNU grep with -P option (PCRE) will allow it, otherwise you have to use [0-9] or the POSIX character set [:digit:] inside a character class

also, ERE is enabled using -E not -e, from GNU grep's man page:

   -e PATTERNS, --regexp=PATTERNS
          Use  PATTERNS  as  the  patterns.   If  this  option  is used multiple times or is combined with the -f
          (--file) option, search for all patterns given.  This option can be used to protect a pattern beginning
          with “-”.

   -E, --extended-regexp
          Interpret PATTERNS as extended regular expressions (EREs, see below).