Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REGEX Problem Expect

Status
Not open for further replies.

NetworkGhost

IS-IT--Management
Apr 12, 2005
1,324
US
Hello All,

After getting some great help from the forum I tried going a little further and am running into another issue.

Here is my code:

set html {<a href="
regexp {\?.*\-\b} $html match match

puts $match

What I want to happen is to grab this part:

?Auto:LogOffR=TRUE-

So I'll break down my regex understanding an maybe someone can clear me up.

\?.*-\b

\? - Match the first instance of the question mark
.* - Capture all text after the question mark
-\b - Stop at the dash "-"

I ran it in Expresso and got the following result:

?Auto:LogOffR=TRUE-10-10

In a expect Script I get :


can't read "match": no such variable
while executing
"puts $match"
(file "./test.sh" line 6)


So basically Im up the creek. Im still trying stuff but would appreciate assistance.



Free Firewall/Network/Systems Support-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top