until the lex/parse is resolved you can put the pattern in a separate var

ksh -cx 's="abbbc" ; p="~(E)b{2,4}" ; d="${s/$p/dummy}" ; print -v .sh.match ; 
print -v $d'

On Mon, 18 Jun 2012 12:01:25 -0400 Glenn Fowler wrote:
> On Mon, 18 Jun 2012 17:28:43 +0200 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= 
> wrote:
> > So what should I do? Escape the } and {?

> aha
> not sure
> it looks like it involves the ksh lexer/parser and how it handles the
> tokenization implications of ~(...) mid-stream
> dgk and I will talk about it this afternoon

> > On Mon, Jun 18, 2012 at 5:21 PM, Glenn Fowler <[email protected]> wrote:
> > >
> > > On Mon, 18 Jun 2012 17:04:44 +0200 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= 
> > > wrote:
> > >> from what I understand a {x,y} in extended regular expressions should
> > >> match x times but no more than y times. But ksh (ast-ksh.20120612)
> > >> returns no matches at all:
> > >> ksh -c 's="abbbc" ; d="${s/~(E)b{2,4}/dummy}" ; print -v .sh.match'
> > >
> > >> Is this a bug?
> > >
> > > first run with -x to checjk the parse
> > >
> > >        ksh -cx 's="abbbc" ; d="${s/~(E)b{2,4}/dummy}" ; print -v 
> > > .sh.match'
> > >
> > > and it does show a problem
> > > --
> > > +t+ s=bbb
> > > +t+ d='bbb/dummy}' <======
> > > +t+ print -v .sh.match
> > > --
> > >
> > > we can double verify that the regex is ok by using the regex test harness
> > > --
> > > bin/package use
> > > cd re
> > > print $'K\t~(E)b{2,4}\tabbbc\t(1,4)' > t.dat
> > > ./testregex t.dat
> > > --
> > >
> > > so it looks like a battle between the 2 '}' in the ${...} expansion
> > >

> > -- 
> >       ,   _                                    _   ,
> >      { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
> > .----'-/`-/     [email protected]   \-`\-'----.
> >  `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
> >       /\/\     Solaris/BSD//C/C++ programmer   /\/\
> >       `--`                                      `--`

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to