Its ~(options)pattern, not ~(options:pattern)

[[ 'x' == ~(G). ]] && print match
match
[[ 'x' == ~(G)x ]] && print match
match

Olga

2010/3/28 Dan Rickhoff <[email protected]>:
>
> AST-Users
> I also suspect that the ksh construct:
> ~(options :pattern-list )
> is not working correctly.  It doesn't seem to be interpreting the grep-like
> regular expression thingies that actually require some interpretation.
> For example, with an exact match, using no grep-like regular
> expression thingies that require some interpretation, it works correctly:
> $ [[ 'x' == ~(G:x) ]]; print $?
> 0
> However, changing the x (inside the parens) to a dot, so that we use a
> grep-like regular expression that does require some interpretation (a simple
> dot character, to match any single character), ksh does not evaluate it as I
> expect it to:
> $ [[ 'x' == ~(G:.) ]]; print $?
> 1
> Or am I misunderstanding the usage of:
> ~(options :pattern-list )
> Dan
> On Mar 28, 2010, at 12:55 AM, ольга крыжановская wrote:
>
> In Solaris ksh93 (which has xgrep as built in utility) I get this:
> (builtin xgrep ; print -- "-a -C" | xgrep '(.*-a.*)&(.*-C.*)')
> -a -C
>
> Glenn, is ~(X) broken in ast-ksh.2010-03-09?
>
> Olga
>
> 2010/3/28 ольга крыжановская <[email protected]>:
>
> OK, I am getting crazy (maybe): Can anyone explain why ksh -c 'x="-a
>
> -C" ; [[ "$x" == ~(Xlr)(.*-a.*)&(.*-C.*) ]] && print true' does not
>
> print 'true"? Xlr selects an augmented extended regular expression,
>
> .*-a.* should be a match, .*-C.* should be a match and & means AND.
>
> I'm banging my head since an hour against the problem with no success.
>
> HELP, please.
>
> Olga
>
> --
>
>     ,   _                                    _   ,
>
>    { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
>
> .----'-/`-/     [email protected]   \-`\-'----.
>
> `'-..-| /     Solaris/BSD//C/C++ programmer   \ |-..-'`
>
>     /\/\                                     /\/\
>
>     `--`                                      `--`
>
>
>
>
> --
>      ,   _                                    _   ,
>     { \/`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
>
>



-- 
      ,   _                                    _   ,
     { \/`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