Reputation: 1
I'm looking to match "Serial Number:" and then store the value in a variable. So far I have this but for some reason it is not finding it.
set value [regexp -line {^\s*Serial Number: (.*)$} $expect_out(buffer) store]
This is the output, I want to match Serial Number and store the value in a variable:
Contents of Main Board IDPROM
Assy, NetNet6300
Serial Number: 091245076951
BoardRev: 03.00
PCB Family Type: Main Board
Options: 0
Upvotes: 0
Views: 34
Reputation: 5274
What you should do is the following:
^\s*Serial Number:[^\d]*(\d+)
Which looks to be like this in your example:
set value [regexp -line {^\s*Serial Number:[^\d]*(\d+)} $expect_out(buffer) store]
I also like h20000000's comment but I prefer to use the negative character class of what I'm looking to capture, either will work!
Upvotes: 1