[clug] Circumflex
Kim Holburn
kim.holburn at gmail.com
Sun Aug 20 09:15:06 UTC 2017
> On 2017/Aug/20, at 5:33 PM, Bryan Kilgallin (iiNet) via linux <linux at lists.samba.org> wrote:
>
> Thanks, Eyal:
>
>> I think that the '\d' notation is a Perl extension, so try
>> grep -P ^\d'
>
> I was confused among versions of regular expressions! Discovering by trial and error. So to search for `-' I had to escape it with `\'.
to search for - in grep you can also use '[-]'
Regular expressions are confusing. Every language and program has a slightly different set. And some like grep have 3 different sets! The full perl reference is here:
http://perldoc.perl.org/perlre.html
Vim uses a different syntax for regex: http://www.vimregex.com/
Python is different again: https://docs.python.org/2/howto/regex.html
Kim
>
> What Web resource explains standard, extended, and Perl variants?
>
>> Note that 'egrep' is short for 'grep -E' (extended regex) and you cannot use '-E' and '-P'
>> together as they have conflicting rules.
> Grep highlighted searched characters--while egrep did not.
> --
> www.netspeed.com.au/bryan/
>
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux
--
Kim Holburn
IT Network & Security Consultant
T: +61 2 61402408 M: +61 404072753
mailto:kim at holburn.net aim://kimholburn
skype://kholburn - PGP Public Key on request
More information about the linux
mailing list