This pattern matches line 345:
(set -x ; printf '123\n234\n345\n456\n' | xgrep '(.45)&(34.)')
+ xgrep '(.45)&(34.)'
+ printf '123\n234\n345\n456\n'
345

But this pattern does not match line 345:
(set -x ; printf '123\n234\n345\n456\n' | xgrep '(45)&(34)')
+ xgrep '(45)&(34)'
+ printf '123\n234\n345\n456\n'

Why? Do xgrep pattern implicitly activate anchors?

Olga

On Tue, Feb 23, 2010 at 11:38 PM, Glenn Fowler <[email protected]> wrote:
>
> On Tue, 23 Feb 2010 23:32:33 +0100 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= 
> wrote:
>> Is there anywhere a document which describes the differences between
>> egrep and xgrep including some examples?
>
> no document
> conjunction is the & binary operator
> negation is the ! unary postfix operator
>
> you can see some test patterns with expected results by
>
>        grep '^A.*[&!]' src/cmd/re/*.dat
>
> the syntax of the .dat files is documented by
>
>        testregex --man
>
> src/cmd/re/testregex.c is a standalone regex test harness
>
>



-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     [email protected]   \-`\-'----.
 `'-..-| /     Solaris/BSD//C/C++ programmer   \ |-..-'`
      /\/\                                     /\/\
      `--`                                      `--`
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to