Posted over 2 years ago. Visible to the public. Repeats.

grep: regex

You can use three different versions of the regular expression syntax in grep:

  • basic: -G
  • extended: -E
  • perl: -P

Difference between basic and extended:

Copy
In basic regular expressions the meta-characters '?', '+', '{', '|', '(', and ')' lose their special meaning; instead use the backslashed versions '\?', '\+', '\{', '\|', '\(', and '\)'.

Difference between extended (POSIX) and perl (PCRE): E.g. \d is not supported in POSIX.

This grep command searches for the same pattern in different regular expression versions.

Copy
grep -G "[0-9]\{4\}ms" production.log grep -E "[0-9]{4}ms" production.log grep -P "\d{4}ms" production.log

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Andreas Robecke
Last edit:
6 months ago
by Henning Koch
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Andreas Robecke to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more