[TriLUG] Re: expect problem

Benjamin Reed rangerrick at befunk.com
Wed Sep 21 14:25:22 EDT 2005


Greg Brown wrote:
> You would think so, but apparently not. I found this example on page 482 of
> the 1996 edition of exploring Expect:
> 
> if [regexp "(\[^:]*:.*\[-, ] (\[0-9]+" $buf dummy ng seen]
> 
> Logically you would think that you would have to escape the "]" but you
> don't seem to have it as strage as that seems.

because once you've escaped the [, it's no longer a matched pair of 
capturing braces

You probably should still escape it for "correctness" but it's not 
necessary.  Since there's no "I'm inside a []" flag set, it's assumed 
that it's just a normal ].



More information about the TriLUG mailing list