Comp Sci: (Li|U)nix: regular expressions part5: grep -P
Self-tutoring about grep and regex: the tutor explores grep -P: P is for Perl.
When it comes to regular expressions, it’s hard to beat Perl. grep -P supports Perl regular expressions, but it’s noted as “experimental.”
I tried it today with a file containing a postal code:
grep -P -i “[a-z]\d[a-z]\d[a-z]\d” testfile
It found the postal code no problem.
As I’ve mentioned: not all systems are the same. Therefore, that experiement may not bring the same success on a different one.
Source:
Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.