Lionel Thiry
10/14/2004 10:52:00 PM
Hello!
Thanks for the help, but I can already handle the recursive expansion of
the strings. My main problem is about the pattern itself, it gives me
headaches.
Some comments follow.
Kaspar Schiess a écrit :
> Hello Lionel,
>
> That was quite a quiz you asked us ;)
>
> I have a solution using only 'regular' regular expressions, the one in
> 1.8.1. Thus: this solution works without oniguruma.
>
> I work around the lookbehind trouble by appending three spaces in front
> of the string.
>
> I am sure this solution is hideously complicated and can be improoved.
> Anyone ?
>
> Here's the output:
> ~ bluna ${var\}weird}
> ~ bluna weird substitute
>
> ~ sh ${tool} -o ${target} -L${libpath} -l${lib} ${source}
> ~ sh gcc -o test.exe -L/usr/lib -lopengl render.c
>
> ~ \${var}
> ~ \${var}
I'd prefer '${var}' as a result, is it possible? Doesn't the (?>re)
expression fit for that purpose? Or should I make some substitution
after the match?
>
> ~ \\${var}
> ~ \\rvar
>
> ~ $\${var}
> ~ $\${var}
In fact, this case should generate an exception, as a non escaped $
should always be immediately followed by a {.
>
> ~ $\$${var}
> ~ $\$rvar
Idem.
But "\\$${var}" should give "$rvar", ideal for letting the shell to make
some postsubstitution with its usual env.
>
> with an env of
>
> ~ env = {
> 'var\}weird' => 'weird substitute',
> 'var' => 'rvar',
> 'tool' => 'gcc',
> 'target' => 'test.exe',
> 'libpath' => '/usr/lib',
> 'lib' => 'opengl',
> 'source' => 'render.c'
> ~ }
>
> Hope this hits your nerv,
> kaspar
I still have a lot of work, but thanks for the help.
Lionel Thiry