From: Roland G. <rgi...@cp...> - 2007-05-08 13:00:54
|
Yes there is. Read the perldoc Expect and look for "matchlist()"... Hope this helps, Roland On 4/25/07, sp...@nc... <sp...@nc...> wrote: > Hello all, > > I've used the "real" expect for a number of years, and now find myself > having to do some stuff w/ perl-expect. > > Is there a way to capture text w/ () in the expect of perl like you can > w/ expect? > > For example the following bit of expect code will grab the hostname of > the device you've logged into and store it in a variable called hostname: > expect { > -re "\n+(.*}>" > } > set hostname $expect_out(1,string) > > The $expect_out(1,string) grabs what is inside the () in the expect > statement. Like a backrefrence \1 in a regexp. > > Is there a way to do the same thing w/ perl expect? > > Thanks in advance. > Sean > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |