there are two types of ~(...) options
(1) mode options change how the associated pattern is applied
mode options are usually lower case and may appear in the two forms
~(options)pattern
~(options:pattern)
example mode options are
g greedy
-g minimal (not greedy)
l left anchor
r right anchor
(2) syntax options change the re syntax and are set by the option only form
~(options)pattern
syntax options are upper case
On Sun, 28 Mar 2010 14:49:30 -0700 Dan Rickhoff wrote:
> --Apple-Mail-33--552005262
> Content-Type: text/plain;
> charset=UTF-8;
> format=flowed;
> delsp=yes
> Content-Transfer-Encoding: quoted-printable
> 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-=20=
> like regular expression thingies that actually require some =20
> interpretation.
> For example, with an exact match, using no grep-like regular =20
> expression thingies that require some interpretation, it works =20
> correctly:
> $ [[ 'x' =3D=3D ~(G:x) ]]; print $?
> 0
> However, changing the x (inside the parens) to a dot, so that we use a =20=
> grep-like regular expression that does require some interpretation (a =20=
> simple dot character, to match any single character), ksh does not =20
> evaluate it as I expect it to:
> $ [[ 'x' =3D=3D ~(G:.) ]]; print $?
> 1
> Or am I misunderstanding the usage of:
> ~(options :pattern-list )
> Dan
> On Mar 28, 2010, at 12:55 AM, =D0=BE=D0=BB=D1=8C=D0=B3=D0=B0 =
> =D0=BA=D1=80=D1=8B=D0=B6=D0=B0=D0=BD=D0=BE=D0=B2=D1=81=D0=BA=D0=B0=D1=8F =
> 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 =D0=BE=D0=BB=D1=8C=D0=B3=D0=B0 =D0=BA=D1=80=D1=8B=D0=B6=D0=B0=D0=
> =BD=D0=BE=D0=B2=D1=81=D0=BA=D0=B0=D1=8F =20
> > <[email protected]>:
> >> OK, I am getting crazy (maybe): Can anyone explain why ksh -c 'x=3D"-a
> >> -C" ; [[ "$x" =3D=3D ~(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 =20
> >> success.
> >> HELP, please.
> >>
> >> Olga
> >> --
> >> , _ _ ,
> >> { \/`o;=3D=3D=3D=3D- Olga Kryzhanovska -=3D=3D=3D=3D;o`\/ }
> >> .----'-/`-/ [email protected] \-`\-'----.
> >> `'-..-| / Solaris/BSD//C/C++ programmer \ |-..-'`
> >> /\/\ /\/\
> >> `--` `--`
> >>
> >
> >
> >
> > --=20
> > , _ _ ,
> > { \/`o;=3D=3D=3D=3D- Olga Kryzhanovska -=3D=3D=3D=3D;o`\/ }
> > .----'-/`-/ [email protected] \-`\-'----.
> > `'-..-| / Solaris/BSD//C/C++ programmer \ |-..-'`
> > /\/\ /\/\
> > `--` `--`
> >
> > _______________________________________________
> > ast-users mailing list
> > [email protected]
> > https://mailman.research.att.com/mailman/listinfo/ast-users
> --Apple-Mail-33--552005262
> Content-Type: text/html;
> charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
> <html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
> -webkit-line-break: after-white-space; =
> "><div><br></div>AST-Users<div><br></div><div>I also suspect that the =
> ksh construct:</div><div><br></div><div><strong><span =
> class=3D"Apple-tab-span" style=3D"white-space: pre; "> =
> </span>~(</strong><em>options </em><strong>:</strong><em>pattern-list=
> </em><strong>)</strong></div><div><b><br></b></div><div>is not =
> working correctly. It doesn't seem to be interpreting the =
> grep-like regular expression thingies that actually require some =
> interpretation.<div><div><br></div><div>For example, with an exact =
> match, using no grep-like regular expression thingies that require =
> some interpretation, it works =
> correctly:</div><div><div><br></div><div><div>$ [[ 'x' =3D=3D ~(G:x) ]]; =
> print $?</div><div>0</div><div><br></div><div>However, changing the x =
> (inside the parens) to a dot, so that we use a grep-like regular =
> expr<font class=3D"Apple-style-span" size=3D"3"><span =
> class=3D"Apple-style-span" style=3D"font-size: 12px;">ession that does =
> require some interpretation (a simple do</span></font>t character, to =
> match any single character), ksh does not evaluate it as I expect it =
> to:</div><div><br></div><div>$ [[ 'x' =3D=3D ~(G:.) ]]; print =
> $?</div><div>1</div><div><br></div><div>Or am I misunderstanding the =
> usage of:</div><div><b><br></b></div><div><strong><span =
> class=3D"Apple-tab-span" style=3D"white-space:pre"> =
> </span>~(</strong><em>options </em><strong>:</strong><em>pattern-list=
> </em><strong>)</strong></div><div><b><br></b></div><div =
> style=3D"font-size: 13px; "><font class=3D"Apple-style-span" size=3D"3" =
> style=3D"font-size: 13px; =
> ">Dan</font></div><div><b><br></b></div><div><div>On Mar 28, 2010, at =
> 12:55 AM, =D0=BE=D0=BB=D1=8C=D0=B3=D0=B0 =D0=BA=D1=80=D1=8B=D0=B6=D0=B0=D0=
> =BD=D0=BE=D0=B2=D1=81=D0=BA=D0=B0=D1=8F wrote:</div><br =
> class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div>In =
> Solaris ksh93 (which has xgrep as built in utility) I get =
> this:<br>(builtin xgrep ; print -- "-a -C" | xgrep =
> '(.*-a.*)&(.*-C.*)')<br>-a -C<br><br>Glenn, is ~(X) broken in =
> ast-ksh.2010-03-09?<br><br>Olga<br><br>2010/3/28 =D0=BE=D0=BB=D1=8C=D0=B3=D0=
> =B0 =D0=BA=D1=80=D1=8B=D0=B6=D0=B0=D0=BD=D0=BE=D0=B2=D1=81=D0=BA=D0=B0=D1=8F=
> <<a =
> href=3D"mailto:[email protected]">[email protected]</a=
> >>:<br><blockquote type=3D"cite">OK, I am getting crazy (maybe): Can =
> anyone explain why ksh -c 'x=3D"-a<br></blockquote><blockquote =
> type=3D"cite">-C" ; [[ "$x" =3D=3D ~(Xlr)(.*-a.*)&(.*-C.*) ]] =
> && print true' does not<br></blockquote><blockquote =
> type=3D"cite">print 'true"? Xlr selects an augmented extended regular =
> expression,<br></blockquote><blockquote type=3D"cite">.*-a.* should be a =
> match, .*-C.* should be a match and & means =
> AND.<br></blockquote><blockquote type=3D"cite">I'm banging my head since =
> an hour against the problem with no success.<br></blockquote><blockquote =
> type=3D"cite">HELP, please.<br></blockquote><blockquote =
> type=3D"cite"><br></blockquote><blockquote =
> type=3D"cite">Olga<br></blockquote><blockquote =
> type=3D"cite">--<br></blockquote><blockquote type=3D"cite"> =
> , _ =
> &n=
> bsp; &nbs=
> p; _ =
> ,<br></blockquote><blockquote type=3D"cite"> =
> { \/`o;=3D=3D=3D=3D- Olga =
> Kryzhanovska -=3D=3D=3D=3D;o`\/ =
> }<br></blockquote><blockquote type=3D"cite">.----'-/`-/ =
> <a =
> href=3D"mailto:[email protected]">[email protected]</a=
> > \-`\-'----.<br></blockquote><blockquote type=3D"cite"> =
> `'-..-| / Solaris/BSD//C/C++ programmer =
> \ |-..-'`<br></blockquote><blockquote type=3D"cite"> =
> /\/\ =
> &n=
> bsp; &nbs=
> p; /\/\<b=
> r></blockquote><blockquote type=3D"cite"> `--` =
> &n=
> bsp; &nbs=
> p; =
> `--`<br></blockquote><blockquote =
> type=3D"cite"><br></blockquote><br><br><br>-- <br> =
> , _ =
> &n=
> bsp; &nbs=
> p; _ =
> ,<br> { \/`o;=3D=3D=3D=3D- =
> Olga Kryzhanovska -=3D=3D=3D=3D;o`\/ =
> }<br>.----'-/`-/ <a =
> href=3D"mailto:[email protected]">[email protected]</a=
> > \-`\-'----.<br> `'-..-| / =
> Solaris/BSD//C/C++ programmer \ =
> |-..-'`<br> /\/\ =
> &n=
> bsp; &nbs=
> p; /\/\<b=
> r> `--` =
> &n=
> bsp; &nbs=
> p; =
> `--`<br><br>_______________________________________________<br>ast-users =
> mailing list<br><a =
> href=3D"mailto:[email protected]">[email protected]</a><=
> br>https://mailman.research.att.com/mailman/listinfo/ast-users<br></div></=
> blockquote></div><br></div></div></div></div></body></html>=
> --Apple-Mail-33--552005262--
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users