Hi,

Edward QU wrote in post #1064855:
> my question is : where is wrong in my 2ed regular express, causing the
> string is not complete, i could not get the whole ipconfig information?
> because the gateway, dhcp, dns information is after the subnet mask
> information.

Well, since you didn't give us the actual output of "ipconfig /all", we 
can only guess. It's probably a value with colons (like a date or an 
IPv6 address) causing the trouble. The parser will stop at this line, 
because you don't allow colons in values.

I'm not exactly sure what you want to do, anyway. If you only want to 
get the "blocks", you should split the output at the headings:

blocks = str_ipcfg.split /(?<=\n\n)(?=\S)/
blocks.each do |block|
  puts block, '---------- end of block ----------'
end

You may then read the lines and split them at the colon to get the 
values.

-- 
Posted via http://www.ruby-forum.com/.