expect:
[plain]
view plain
copy
- expect
-re "([0-9]*)([a-zA-Z]*)" - send_user
"num is $expect_out(1,string), string is $expect_out(1,string)"
这里[0-9]*表示一个或多个数字, [a-zA-Z]*表示多个字母。()用于分组,它们分别存放在 $expect_out(1,string)和$expect_out(2,string)中。
pexpect:python中的expect
[plain]